Changes in [501:ead05faef1e4:503:a4f39cc10d7a]
- Files:
-
- 39 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
.hgignore
r358 r503 1 1 cache 2 public3 2 inc/config.php 4 3 \.htaccess 4 public/filters 5 themes/ductile/_work 6 themes/ductile-work 7 themes/ductile/default-templates -
admin/blog_theme.php
r500 r503 156 156 157 157 $radio_id = 'theme_'.html::escapeHTML($id); 158 if (preg_match('#^http(s)?://#',$core->blog->settings->system->themes_url)) { 159 $theme_url = http::concatURL($core->blog->settings->system->themes_url,'/'.$id); 160 } else { 161 $theme_url = http::concatURL($core->blog->url,$core->blog->settings->system->themes_url.'/'.$id); 162 } 158 $theme_url = http::concatURL($core->blog->url,$core->blog->settings->system->themes_url.'/'.$id); 163 159 $has_conf = file_exists(path::real($core->blog->themes_path.'/'.$id).'/_config.php'); 164 160 $has_css = file_exists(path::real($core->blog->themes_path.'/'.$id).'/style.css'); … … 216 212 { 217 213 echo 218 '<h2>'.html::escapeHTML($core->blog->name).' › <span class="page-title">'.__('Blog appearance').'</span></h2>';214 '<h2>'.html::escapeHTML($core->blog->name).' › '.__('Blog appearance').'</h2>'; 219 215 220 216 if (!empty($_GET['upd'])) { … … 333 329 echo 334 330 '<h2>'.html::escapeHTML($core->blog->name). 335 ' › <a href="blog_theme.php">'.__('Blog appearance').'</a> › <span class="page-title">'.__('Theme configuration').'<span class="page-title"></h2>'.331 ' › <a href="blog_theme.php">'.__('Blog appearance').'</a> › '.__('Theme configuration').'</h2>'. 336 332 '<p><a class="back" href="blog_theme.php">'.__('back').'</a></p>'; 337 333 338 334 try 339 335 { 340 # Let theme configuration set their own form(s) if required341 $ standalone_config = (boolean) $core->themes->moduleInfo($core->blog->settings->system->theme,'standalone_config');342 343 if (!$ standalone_config)336 # Let theme configuration set their own form(s) 337 $managed = (boolean) $core->callBehavior('adminThemeConfigManaged'); 338 339 if (!$managed) 344 340 echo '<form id="theme_config" action="blog_theme.php?conf=1" method="post" enctype="multipart/form-data">'; 345 341 346 342 include $theme_conf_file; 347 343 348 if (!$ standalone_config)344 if (!$managed) 349 345 echo 350 346 '<p class="clear"><input type="submit" value="'.__('Save').'" />'. 351 347 $core->formNonce().'</p>'. 352 348 '</form>'; 353 354 349 } 355 350 catch (Exception $e) -
admin/style/default.css
r500 r503 1179 1179 p.field { 1180 1180 position: relative; 1181 1181 1182 1182 } 1183 1183 p.field label { -
inc/public/prepend.php
r270 r420 113 113 $core->themes->loadNsFile($__theme,'public'); 114 114 115 # Loading translations for selected theme 116 if ($__parent_theme) { 117 $core->themes->loadModuleL10N($__parent_theme,$_lang,'main'); 118 } 119 $core->themes->loadModuleL10N($__theme,$_lang,'main'); 120 115 121 # --BEHAVIOR-- publicPrepend 116 122 $core->callBehavior('publicPrepend',$core); -
plugins/blowupConfig/_public.php
r270 r295 25 25 echo '<style type="text/css">'."\n".self::blowUpStyleHelper()."\n</style>\n"; 26 26 } 27 27 28 28 public static function blowUpStyleHelper() 29 29 { 30 30 $s = $GLOBALS['core']->blog->settings->themes->blowup_style; 31 31 32 32 if ($s === null) { 33 33 return; 34 34 } 35 35 36 36 $s = @unserialize($s); 37 37 if (!is_array($s)) { 38 38 return; 39 39 } 40 40 41 41 $css = array(); 42 42 43 43 /* Sidebar position 44 44 ---------------------------------------------- */ … … 48 48 $css['#sidebar']['float'] = 'left'; 49 49 } 50 50 51 51 /* Properties 52 52 ---------------------------------------------- */ 53 53 self::prop($css,'body','background-color',$s['body_bg_c']); 54 54 55 55 self::prop($css,'body','color',$s['body_txt_c']); 56 56 self::prop($css,'.post-tags li a:link, .post-tags li a:visited, .post-info-co a:link, .post-info-co a:visited','color',$s['body_txt_c']); 57 57 self::prop($css,'#page','font-size',$s['body_txt_s']); 58 58 self::prop($css,'body','font-family',blowupConfig::fontDef($s['body_txt_f'])); 59 59 60 60 self::prop($css,'.post-content, .post-excerpt, #comments dd, #pings dd, dd.comment-preview','line-height',$s['body_line_height']); 61 61 62 62 if (!$s['blog_title_hide']) 63 63 { … … 65 65 self::prop($css,'#top h1','font-size',$s['blog_title_s']); 66 66 self::prop($css,'#top h1','font-family',blowupConfig::fontDef($s['blog_title_f'])); 67 67 68 68 if ($s['blog_title_a'] == 'right' || $s['blog_title_a'] == 'left') { 69 69 $css['#top h1'][$s['blog_title_a']] = '0px'; 70 70 $css['#top h1']['width'] = 'auto'; 71 71 } 72 72 73 73 if ($s['blog_title_p']) 74 74 { … … 92 92 } 93 93 self::prop($css,'#top','height',$s['top_height']); 94 94 95 95 self::prop($css,'.day-date','color',$s['date_title_c']); 96 96 self::prop($css,'.day-date','font-family',blowupConfig::fontDef($s['date_title_f'])); 97 97 self::prop($css,'.day-date','font-size',$s['date_title_s']); 98 98 99 99 self::prop($css,'a','color',$s['body_link_c']); 100 100 self::prop($css,'a:visited','color',$s['body_link_v_c']); 101 101 self::prop($css,'a:hover, a:focus, a:active','color',$s['body_link_f_c']); 102 102 103 103 self::prop($css,'#comment-form input, #comment-form textarea','color',$s['body_link_c']); 104 104 self::prop($css,'#comment-form input.preview','color',$s['body_link_c']); … … 108 108 self::prop($css,'#comment-form input.submit:hover','background',$s['body_link_f_c']); 109 109 self::prop($css,'#comment-form input.submit:hover','border-color',$s['body_link_f_c']); 110 110 111 111 self::prop($css,'#sidebar','font-family',blowupConfig::fontDef($s['sidebar_text_f'])); 112 112 self::prop($css,'#sidebar','font-size',$s['sidebar_text_s']); 113 113 self::prop($css,'#sidebar','color',$s['sidebar_text_c']); 114 114 115 115 self::prop($css,'#sidebar h2','font-family',blowupConfig::fontDef($s['sidebar_title_f'])); 116 116 self::prop($css,'#sidebar h2','font-size',$s['sidebar_title_s']); 117 117 self::prop($css,'#sidebar h2','color',$s['sidebar_title_c']); 118 118 119 119 self::prop($css,'#sidebar h3','font-family',blowupConfig::fontDef($s['sidebar_title2_f'])); 120 120 self::prop($css,'#sidebar h3','font-size',$s['sidebar_title2_s']); 121 121 self::prop($css,'#sidebar h3','color',$s['sidebar_title2_c']); 122 122 123 123 self::prop($css,'#sidebar ul','border-top-color',$s['sidebar_line_c']); 124 124 self::prop($css,'#sidebar li','border-bottom-color',$s['sidebar_line_c']); 125 125 self::prop($css,'#topnav ul','border-bottom-color',$s['sidebar_line_c']); 126 126 127 127 self::prop($css,'#sidebar li a','color',$s['sidebar_link_c']); 128 128 self::prop($css,'#sidebar li a:visited','color',$s['sidebar_link_v_c']); … … 132 132 self::prop($css,'#search .submit:hover','background',$s['sidebar_link_f_c']); 133 133 self::prop($css,'#search .submit:hover','border-color',$s['sidebar_link_f_c']); 134 134 135 135 self::prop($css,'.post-title','color',$s['post_title_c']); 136 136 self::prop($css,'.post-title a, .post-title a:visited','color',$s['post_title_c']); 137 137 self::prop($css,'.post-title','font-family',blowupConfig::fontDef($s['post_title_f'])); 138 138 self::prop($css,'.post-title','font-size',$s['post_title_s']); 139 139 140 140 self::prop($css,'#comments dd','background-color',$s['post_comment_bg_c']); 141 141 self::prop($css,'#comments dd','color',$s['post_comment_c']); 142 142 self::prop($css,'#comments dd.me','background-color',$s['post_commentmy_bg_c']); 143 143 self::prop($css,'#comments dd.me','color',$s['post_commentmy_c']); 144 144 145 145 self::prop($css,'#prelude, #prelude a','color',$s['prelude_c']); 146 146 147 147 self::prop($css,'#footer p','background-color',$s['footer_bg_c']); 148 148 self::prop($css,'#footer p','color',$s['footer_c']); … … 150 150 self::prop($css,'#footer p','font-family',blowupConfig::fontDef($s['footer_f'])); 151 151 self::prop($css,'#footer p a','color',$s['footer_l_c']); 152 152 153 153 /* Images 154 154 ------------------------------------------------------ */ … … 164 164 self::backgroundImg($css,'#comments dt.me',$s['post_commentmy_bg_c'],'commentmy-t.png'); 165 165 self::backgroundImg($css,'#comments dd.me',$s['post_commentmy_bg_c'],'commentmy-b.png'); 166 166 167 167 $res = ''; 168 168 foreach ($css as $selector => $values) { … … 173 173 $res .= "}\n"; 174 174 } 175 176 $res .= $s['extra_css']; 177 175 178 return $res; 176 179 } 177 180 178 181 protected static function prop(&$css,$selector,$prop,$value) 179 182 { … … 182 185 } 183 186 } 184 187 185 188 protected static function backgroundImg(&$css,$selector,$value,$image) 186 189 { -
plugins/blowupConfig/index.php
r500 r503 24 24 'body_bg_c' => null, 25 25 'body_bg_g' => 'light', 26 26 27 27 'body_txt_f' => null, 28 28 'body_txt_s' => null, 29 29 'body_txt_c' => null, 30 30 'body_line_height' => null, 31 31 32 32 'top_image' => 'default', 33 33 'top_height' => null, 34 34 'uploaded' => null, 35 35 36 36 'blog_title_hide' => null, 37 37 'blog_title_f' => null, … … 40 40 'blog_title_a' => null, 41 41 'blog_title_p' => null, 42 42 43 43 'body_link_c' => null, 44 44 'body_link_f_c' => null, 45 45 'body_link_v_c' => null, 46 46 47 47 'sidebar_position' => null, 48 48 'sidebar_text_f' => null, … … 59 59 'sidebar_link_f_c' => null, 60 60 'sidebar_link_v_c' => null, 61 61 62 62 'date_title_f' => null, 63 63 'date_title_s' => null, 64 64 'date_title_c' => null, 65 65 66 66 'post_title_f' => null, 67 67 'post_title_s' => null, … … 71 71 'post_commentmy_bg_c' => null, 72 72 'post_commentmy_c' => null, 73 73 74 74 'prelude_c' => null, 75 75 'footer_f' => null, … … 78 78 'footer_l_c' => null, 79 79 'footer_bg_c' => null, 80 81 'extra_css' => null 80 82 ); 81 83 … … 108 110 $blowup_user['body_txt_c'] = blowupConfig::adjustColor($_POST['body_txt_c']); 109 111 $blowup_user['body_line_height'] = blowupConfig::adjustFontSize($_POST['body_line_height']); 110 112 111 113 $blowup_user['blog_title_hide'] = (integer) !empty($_POST['blog_title_hide']); 112 114 $update_blog_title = !$blowup_user['blog_title_hide'] && ( … … 115 117 !empty($_POST['blog_title_p']) 116 118 ); 117 119 118 120 if ($update_blog_title) 119 121 { … … 124 126 $blowup_user['blog_title_p'] = blowupConfig::adjustPosition($_POST['blog_title_p']); 125 127 } 126 128 127 129 $blowup_user['body_link_c'] = blowupConfig::adjustColor($_POST['body_link_c']); 128 130 $blowup_user['body_link_f_c'] = blowupConfig::adjustColor($_POST['body_link_f_c']); 129 131 $blowup_user['body_link_v_c'] = blowupConfig::adjustColor($_POST['body_link_v_c']); 130 132 131 133 $blowup_user['sidebar_text_f'] = $_POST['sidebar_text_f']; 132 134 $blowup_user['sidebar_text_s'] = blowupConfig::adjustFontSize($_POST['sidebar_text_s']); … … 142 144 $blowup_user['sidebar_link_f_c'] = blowupConfig::adjustColor($_POST['sidebar_link_f_c']); 143 145 $blowup_user['sidebar_link_v_c'] = blowupConfig::adjustColor($_POST['sidebar_link_v_c']); 144 146 145 147 $blowup_user['sidebar_position'] = ($_POST['sidebar_position'] == 'left') ? 'left' : null; 146 148 147 149 $blowup_user['date_title_f'] = $_POST['date_title_f']; 148 150 $blowup_user['date_title_s'] = blowupConfig::adjustFontSize($_POST['date_title_s']); 149 151 $blowup_user['date_title_c'] = blowupConfig::adjustColor($_POST['date_title_c']); 150 152 151 153 $blowup_user['post_title_f'] = $_POST['post_title_f']; 152 154 $blowup_user['post_title_s'] = blowupConfig::adjustFontSize($_POST['post_title_s']); … … 154 156 $blowup_user['post_comment_c'] = blowupConfig::adjustColor($_POST['post_comment_c']); 155 157 $blowup_user['post_commentmy_c'] = blowupConfig::adjustColor($_POST['post_commentmy_c']); 156 157 158 159 158 160 $blowup_user['footer_f'] = $_POST['footer_f']; 159 161 $blowup_user['footer_s'] = blowupConfig::adjustFontSize($_POST['footer_s']); … … 161 163 $blowup_user['footer_l_c'] = blowupConfig::adjustColor($_POST['footer_l_c']); 162 164 $blowup_user['footer_bg_c'] = blowupConfig::adjustColor($_POST['footer_bg_c']); 163 165 166 167 $blowup_user['extra_css'] = blowupConfig::cleanCSS($_POST['extra_css']); 168 164 169 if ($can_write_images) 165 170 { … … 168 173 $uploaded = blowupConfig::imagesPath().'/'.$blowup_user['uploaded']; 169 174 } 170 175 171 176 if (!empty($_FILES['upfile']) && !empty($_FILES['upfile']['name'])) { 172 177 files::uploadStatus($_FILES['upfile']); … … 174 179 $blowup_user['uploaded'] = basename($uploaded); 175 180 } 176 181 177 182 $blowup_user['top_image'] = in_array($_POST['top_image'],$top_images) ? $_POST['top_image'] : 'default'; 178 183 179 184 $blowup_user['body_bg_c'] = blowupConfig::adjustColor($_POST['body_bg_c']); 180 185 $blowup_user['body_bg_g'] = in_array($_POST['body_bg_g'],$gradient_types) ? $_POST['body_bg_g'] : ''; … … 184 189 blowupConfig::createImages($blowup_user,$uploaded); 185 190 } 186 191 187 192 $core->blog->settings->addNamespace('themes'); 188 193 $core->blog->settings->themes->put('blowup_style',serialize($blowup_user)); 189 194 $core->blog->triggerBlog(); 190 195 191 196 http::redirect($p_url.'&upd=1'); 192 197 } … … 233 238 234 239 echo '<form id="theme_config" action="'.$p_url.'" method="post" enctype="multipart/form-data">'; 235 240 236 241 echo '<fieldset><legend>'.__('General').'</legend>'; 237 242 … … 240 245 '<p class="field"><label for="body_bg_c">'.__('Background color:').' '. 241 246 form::field('body_bg_c',7,7,$blowup_user['body_bg_c'],'colorpicker').'</label></p>'. 242 247 243 248 '<p class="field"><label for="body_bg_g">'.__('Background color fill:').' '. 244 249 form::combo('body_bg_g',$gradient_types,$blowup_user['body_bg_g']).'</label></p>'; … … 304 309 $preview_image = 'index.php?pf=blowupConfig/alpha-img/page-t/'.$blowup_user['top_image'].'.png'; 305 310 } 306 311 307 312 echo 308 313 '<fieldset><legend>'.__('Top image').'</legend>'. … … 310 315 form::combo('top_image',$top_images,($blowup_user['top_image'] ? $blowup_user['top_image'] : 'default')).'</label></p>'. 311 316 '<p>'.__('Choose "Custom..." to upload your own image.').'</p>'. 312 317 313 318 '<p id="uploader"><label for="upfile">'.__('Add your image:'). 314 319 ' ('.sprintf(__('JPEG or PNG file, 800 pixels wide, maximum size %s'),files::size(DC_MAX_UPLOAD_SIZE)).')'. 315 320 '<input type="file" name="upfile" id="upfile" size="35" />'. 316 321 '</label></p>'. 317 322 318 323 '<h3>'.__('Preview').'</h3>'. 319 324 '<div class="grid" style="width:800px;border:1px solid #ccc;">'. … … 425 430 '</fieldset>'; 426 431 432 echo 433 '<fieldset><legend>'.__('Additional CSS').'</legend>'. 434 '<p>'.form::textarea('extra_css',72,5,html::escapeHTML($blowup_user['extra_css']),'maximal','',false,'title="'.__('Additional CSS').'"').'</p>'. 435 '</fieldset>'; 436 437 438 427 439 // Import / Export configuration 428 440 $tmp_array = array(); -
plugins/blowupConfig/lib/class.blowup.config.php
r270 r295 22 22 'ss5' => 'Impact, Charcoal, sans-serif' 23 23 ), 24 24 25 25 'serif' => array( 26 26 's1' => 'Times, "Times New Roman", serif', … … 28 28 's3' => 'Baskerville, "Palatino Linotype", serif' 29 29 ), 30 30 31 31 'monospace' => array( 32 32 'm1' => '"Andale Mono", "Courier New", monospace', … … 34 34 ) 35 35 ); 36 36 37 37 protected static $fonts_combo = array(); 38 38 protected static $fonts_list = array(); 39 39 40 40 public static $top_images = array( 41 41 'default' => 'Default', … … 55 55 'typo' => 'Typo', 56 56 ); 57 57 58 58 public static function fontsList() 59 59 { … … 70 70 } 71 71 } 72 72 73 73 return self::$fonts_combo; 74 74 } 75 75 76 76 public static function fontDef($c) 77 77 { … … 85 85 } 86 86 } 87 87 88 88 return isset(self::$fonts_list[$c]) ? self::$fonts_list[$c] : null; 89 89 } 90 90 91 91 public static function adjustFontSize($s) 92 92 { … … 97 97 return $m[1].$m[2]; 98 98 } 99 99 100 100 return null; 101 101 } 102 102 103 103 public static function adjustPosition($p) 104 104 { … … 106 106 return null; 107 107 } 108 108 109 109 $p = explode(':',$p); 110 110 111 111 return $p[0].(count($p) == 1 ? ':0' : ':'.$p[1]); 112 112 } 113 113 114 114 public static function adjustColor($c) 115 115 { … … 117 117 return ''; 118 118 } 119 119 120 120 $c = strtoupper($c); 121 121 122 122 if (preg_match('/^[A-F0-9]{3,6}$/',$c)) { 123 123 $c = '#'.$c; 124 124 } 125 125 126 126 if (preg_match('/^#[A-F0-9]{6}$/',$c)) { 127 127 return $c; 128 128 } 129 129 130 130 if (preg_match('/^#[A-F0-9]{3,}$/',$c)) { 131 131 return '#'.substr($c,1,1).substr($c,1,1).substr($c,2,1).substr($c,2,1).substr($c,3,1).substr($c,3,1); 132 132 } 133 133 134 134 return ''; 135 135 } 136 136 137 public static function cleanCSS($css) 138 { 139 // TODO ? 140 return $css; 141 } 142 137 143 public static function imagesPath() 138 144 { … … 140 146 return path::real($core->blog->public_path).'/blowup-images'; 141 147 } 142 148 143 149 public static function imagesURL() 144 150 { … … 146 152 return $core->blog->settings->system->public_url.'/blowup-images'; 147 153 } 148 154 149 155 public static function canWriteImages($create=false) 150 156 { 151 157 global $core; 152 158 153 159 $public = path::real($core->blog->public_path); 154 160 $imgs = self::imagesPath(); 155 161 156 162 if (!function_exists('imagecreatetruecolor') || !function_exists('imagepng') || !function_exists('imagecreatefrompng')) { 157 163 $core->error->add(__('At least one of the following functions is not available: '. … … 159 165 return false; 160 166 } 161 167 162 168 if (!is_dir($public)) { 163 169 $core->error->add(__('The \'public\' directory does not exist.')); 164 170 return false; 165 171 } 166 172 167 173 if (!is_dir($imgs)) { 168 174 if (!is_writable($public)) { … … 175 181 return true; 176 182 } 177 183 178 184 if (!is_writable($imgs)) { 179 185 $core->error->add(sprintf(__('The \'%s\' directory cannot be modified.'),'public/blowup-images')); 180 186 return false; 181 187 } 182 188 183 189 return true; 184 190 } 185 191 186 192 public static function uploadImage($f) 187 193 { … … 189 195 throw new Exception(__('Unable to create images.')); 190 196 } 191 197 192 198 $name = $f['name']; 193 199 $type = files::getMimeType($name); 194 200 195 201 if ($type != 'image/jpeg' && $type != 'image/png') { 196 202 throw new Exception(__('Invalid file type.')); 197 203 } 198 204 199 205 $dest = self::imagesPath().'/uploaded'.($type == 'image/png' ? '.png' : '.jpg'); 200 206 201 207 if (@move_uploaded_file($f['tmp_name'],$dest) === false) { 202 208 throw new Exception(__('An error occurred while writing the file.')); 203 209 } 204 210 205 211 $s = getimagesize($dest); 206 212 if ($s[0] != 800) { 207 213 throw new Exception(__('Uploaded image is not 800 pixels wide.')); 208 214 } 209 215 210 216 return $dest; 211 217 } 212 218 213 219 public static function createImages(&$config,$uploaded) 214 220 { … … 219 225 $comment_color_my = $config['post_commentmy_bg_c']; 220 226 $top_image = $config['top_image']; 221 227 222 228 $config['top_height'] = null; 223 229 224 230 if ($top_image != 'custom' && !isset(self::$top_images[$top_image])) { 225 231 $top_image = 'default'; … … 228 234 $uploaded = null; 229 235 } 230 236 231 237 if (!self::canWriteImages(true)) { 232 238 throw new Exception(__('Unable to create images.')); 233 239 } 234 240 235 241 $body_fill = array( 236 242 'light' => dirname(__FILE__).'/../alpha-img/gradient-l.png', … … 238 244 'dark' => dirname(__FILE__).'/../alpha-img/gradient-d.png' 239 245 ); 240 246 241 247 $body_g = isset($body_fill[$gradient]) ? $body_fill[$gradient] : false; 242 248 243 249 if ($top_image == 'custom' && $uploaded) { 244 250 $page_t = $uploaded; … … 246 252 $page_t = dirname(__FILE__).'/../alpha-img/page-t/'.$top_image.'.png'; 247 253 } 248 254 249 255 $body_bg = dirname(__FILE__).'/../alpha-img/body-bg.png'; 250 256 $page_t_mask = dirname(__FILE__).'/../alpha-img/page-t/image-mask.png'; … … 254 260 $default_bg = '#e0e0e0'; 255 261 $default_prelude = '#ededed'; 256 262 257 263 self::dropImage(basename($body_bg)); 258 264 self::dropImage('page-t.png'); … … 260 266 self::dropImage(basename($comment_t)); 261 267 self::dropImage(basename($comment_b)); 262 268 263 269 $body_color = self::adjustColor($body_color); 264 270 $prelude_color = self::adjustColor($prelude_color); 265 271 $comment_color = self::adjustColor($comment_color); 266 272 267 273 if ($top_image || $body_color || $gradient != 'light' || $prelude_color || $uploaded) 268 274 { … … 271 277 } 272 278 $body_color = sscanf($body_color,'#%2X%2X%2X'); 273 279 274 280 # Create body gradient with color 275 281 $d_body_bg = imagecreatetruecolor(50,180); 276 282 $fill = imagecolorallocate($d_body_bg,$body_color[0],$body_color[1],$body_color[2]); 277 283 imagefill($d_body_bg,0,0,$fill); 278 284 279 285 # User choosed a gradient 280 286 if ($body_g) { … … 284 290 imagedestroy($s_body_bg); 285 291 } 286 292 287 293 if (!$prelude_color) { 288 294 $prelude_color = $default_prelude; 289 295 } 290 296 $prelude_color = sscanf($prelude_color,'#%2X%2X%2X'); 291 297 292 298 $s_prelude = imagecreatetruecolor(50,30); 293 299 $fill = imagecolorallocate($s_prelude,$prelude_color[0],$prelude_color[1],$prelude_color[2]); 294 300 imagefill($s_prelude,0,0,$fill); 295 301 imagecopy($d_body_bg,$s_prelude,0,0,0,0,50,30); 296 302 297 303 imagepng($d_body_bg,self::imagesPath().'/'.basename($body_bg)); 298 304 } 299 305 300 306 if ($top_image || $body_color || $gradient != 'light') 301 307 { … … 304 310 $size = $size[1]; 305 311 $type = files::getMimeType($page_t); 306 312 307 313 $d_page_t = imagecreatetruecolor(800,$size); 308 314 309 315 if ($type == 'image/png') { 310 316 $s_page_t = @imagecreatefrompng($page_t); … … 312 318 $s_page_t = @imagecreatefromjpeg($page_t); 313 319 } 314 320 315 321 if (!$s_page_t) { 316 322 throw new exception(__('Unable to open image.')); 317 323 } 318 324 319 325 $fill = imagecolorallocate($d_page_t,$body_color[0],$body_color[1],$body_color[2]); 320 326 imagefill($d_page_t,0,0,$fill); 321 327 322 328 if ($type == 'image/png') 323 329 { … … 331 337 # JPEG, we add image and a frame with rounded corners 332 338 imagecopy($d_page_t,$s_page_t,0,0,0,0,800,$size); 333 339 334 340 imagecopy($d_page_t,$d_body_bg,0,0,0,50,8,4); 335 341 imagecopy($d_page_t,$d_body_bg,0,4,0,54,4,4); 336 342 imagecopy($d_page_t,$d_body_bg,792,0,0,50,8,4); 337 343 imagecopy($d_page_t,$d_body_bg,796,4,0,54,4,4); 338 344 339 345 $mask = imagecreatefrompng($page_t_mask); 340 346 imagealphablending($mask,true); 341 347 imagecopy($d_page_t,$mask,0,0,0,0,800,11); 342 348 imagedestroy($mask); 343 349 344 350 $fill = imagecolorallocate($d_page_t,255,255,255); 345 351 imagefilledrectangle($d_page_t,0,11,3,$size-1,$fill); … … 347 353 imagefilledrectangle($d_page_t,0,$size-9,799,$size-1,$fill); 348 354 } 349 355 350 356 $config['top_height'] = ($size).'px'; 351 357 352 358 imagepng($d_page_t,self::imagesPath().'/page-t.png'); 353 359 354 360 imagedestroy($d_body_bg); 355 361 imagedestroy($d_page_t); 356 362 imagedestroy($s_page_t); 357 363 358 364 # Create bottom image with color 359 365 $d_page_b = imagecreatetruecolor(800,8); 360 366 $fill = imagecolorallocate($d_page_b,$body_color[0],$body_color[1],$body_color[2]); 361 367 imagefill($d_page_b,0,0,$fill); 362 368 363 369 $s_page_b = imagecreatefrompng($page_b); 364 370 imagealphablending($s_page_b,true); 365 371 imagecopy($d_page_b,$s_page_b,0,0,0,0,800,160); 366 372 367 373 imagepng($d_page_b,self::imagesPath().'/'.basename($page_b)); 368 374 369 375 imagedestroy($d_page_b); 370 376 imagedestroy($s_page_b); 371 377 } 372 378 373 379 if ($comment_color) { 374 380 self::commentImages($comment_color,$comment_t,$comment_b,basename($comment_t),basename($comment_b)); … … 378 384 } 379 385 } 380 386 381 387 protected static function commentImages($comment_color,$comment_t,$comment_b,$dest_t,$dest_b) 382 388 { 383 389 $comment_color = sscanf($comment_color,'#%2X%2X%2X'); 384 390 385 391 $d_comment_t = imagecreatetruecolor(500,25); 386 392 $fill = imagecolorallocate($d_comment_t,$comment_color[0],$comment_color[1],$comment_color[2]); 387 393 imagefill($d_comment_t,0,0,$fill); 388 394 389 395 $s_comment_t = imagecreatefrompng($comment_t); 390 396 imagealphablending($s_comment_t,true); 391 397 imagecopy($d_comment_t,$s_comment_t,0,0,0,0,500,25); 392 398 393 399 imagepng($d_comment_t,self::imagesPath().'/'.$dest_t); 394 400 imagedestroy($d_comment_t); 395 401 imagedestroy($s_comment_t); 396 402 397 403 $d_comment_b = imagecreatetruecolor(500,7); 398 404 $fill = imagecolorallocate($d_comment_b,$comment_color[0],$comment_color[1],$comment_color[2]); 399 405 imagefill($d_comment_b,0,0,$fill); 400 406 401 407 $s_comment_b = imagecreatefrompng($comment_b); 402 408 imagealphablending($s_comment_b,true); 403 409 imagecopy($d_comment_b,$s_comment_b,0,0,0,0,500,7); 404 410 405 411 imagepng($d_comment_b,self::imagesPath().'/'.$dest_b); 406 412 imagedestroy($d_comment_b); 407 413 imagedestroy($s_comment_b); 408 414 } 409 415 410 416 public static function dropImage($img) 411 417 {
Note: See TracChangeset
for help on using the changeset viewer.