Changeset 2447


Ignore:
Timestamp:
Jul 22, 2008, 8:17:40 AM (16 years ago)
Author:
vdigital
Message:

Swift Theme Creator (minor changes): non functional version yet.

Location:
trunk/plugins/SwiftThemeCreator
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/SwiftThemeCreator/theme_creator.php

    r2445 r2447  
    4646$errors = array();
    4747$infos = array();
     48$available_templates = array();
     49$template_dir = PHPWG_ROOT_PATH.'template';
     50foreach (get_dirs($template_dir) as $dir)
     51{
     52  array_push($available_templates, $dir);
     53}
     54
    4855// +-----------------------------------------------------------------------+
    4956// |                            selected templates                         |
     
    109116
    110117  // 3 - Directory control
    111   $available_templates = array();
    112   $template_dir = PHPWG_ROOT_PATH.'template';
    113   foreach (get_dirs($template_dir) as $dir)
    114   {
    115     array_push($available_templates, $dir);
    116   }
    117118  $templatedir = PHPWG_ROOT_PATH . 'template/'
    118119               . $available_templates[$_POST['template']];
     
    126127
    127128  // 4 - Picture URL control
     129  if ( $_POST['background'] == 'fixed' and (is_dir($_POST['picture_url'])
     130      or !is_file($_POST['picture_url'])) )
     131    array_push($errors,
     132       l10n('Header picture is not found, check its path and name.'));
     133 
    128134  // 5 - Width and Height control
    129135  // 6 - Generate missing colors values
    130 
    131 
    132   // Lors du parse si le second arg est à true, on récupère le résultat
    133   // http://www.barelyfitz.com/projects/csscolor/csscolor.zip
    134136
    135137  /*
    136138   * Build background image for titrePage or definition list (in #menubar)
    137139   **/
    138   $img = imagecreatefrompng(dirname(__FILE__) . '/titrePage-bg.png');
    139   $dest = imagecreate(1, 64);
    140   for ($i=0; $i<256; $i++) {
    141     imagecolorallocate($dest, $i, $i, $i);
     140  if (function_exists('imagecreatefrompng'))
     141  {
     142    $img = imagecreatefrompng(dirname(__FILE__) . '/titrePage-bg.png');
     143    $dest = imagecreate(1, 64);
     144    for ($i=0; $i<256; $i++) {
     145      imagecolorallocate($dest, $i, $i, $i);
     146    }
     147    imagecopy($dest, $img, 0, 0, 0, 0, 1, 64);
     148    list($r1,$g1,$b1) = stc_hex2rgb($main['color'][4]);
     149    for ($i = 0; $i < 256; $i++) {
     150      imagecolorset($dest, $i, min($i * $r1 / 255, 255),
     151                     min($i * $g1 / 255, 255),
     152                     min($i * $b1 / 255, 255));
     153    }
     154    // to be tested imagecopymerge($dest,$img,0,0,0,0,1,64,33);
     155   
     156    // Uncomment to create the header stc.png
     157    // imagepng( $dest, dirname(__FILE__) . '/stc.png', 9 );
     158    imagedestroy ($img);
     159    imagedestroy ($dest);
    142160  }
    143   imagecopy($dest, $img, 0, 0, 0, 0, 1, 64);
    144   list($r1,$g1,$b1) = stc_hex2rgb($main['color'][4]);
    145   for ($i = 0; $i < 256; $i++) {
    146     imagecolorset($dest, $i, min($i * $r1 / 255, 255),
    147                    min($i * $g1 / 255, 255),
    148                    min($i * $b1 / 255, 255));
    149   }
    150   // to be tested imagecopymerge($dest,$img,0,0,0,0,1,64,33);
    151  
    152   // Uncomment to create the header stc.png
    153   // imagepng( $dest, dirname(__FILE__) . '/stc.png', 9 );
    154   imagedestroy ($img);
    155   imagedestroy ($dest);
    156 
    157161  /* en gros reste à faire:
    158162   * creation de la directory
     
    160164   * parse pour theme.css et ecriture directe pour les autres 
    161165   */
     166  // Lors du parse si le second arg est à true, on récupère le résultat
     167  // http://www.barelyfitz.com/projects/csscolor/csscolor.zip
    162168
    163169  // Go ahead
     
    231237    $_POST['src_category'];
    232238
    233 $main['picture_url'] = get_absolute_root_url()
    234                      . 'plugins/SwiftThemeCreator/sample.jpg';
     239$main['picture_url'] = PHPWG_ROOT_PATH . 'plugins/SwiftThemeCreator/sample.jpg';
    235240if (isset($swift_theme_creator->picture_url))
    236241    $main['picture_url'] = $swift_theme_creator->picture_url;
  • trunk/plugins/SwiftThemeCreator/theme_creator.tpl

    r2445 r2447  
    111111  <tr>
    112112    <td style="padding-right:20px;">
    113       {'Picture address (URL)'|@translate}
     113      {'Picture relative local path'|@translate}
    114114    </td><td>
    115115    <label>
Note: See TracChangeset for help on using the changeset viewer.