Changeset 14649
- Timestamp:
- May 2, 2012, 6:29:56 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/configuration.php
r14513 r14649 455 455 } 456 456 457 $common_quality = 50;458 459 457 $tpl_vars = array(); 460 458 foreach(ImageStdParams::get_all_types() as $type) … … 487 485 } 488 486 $tpl_var['sharpen'] = $params->sharpen; 489 $tpl_var['quality'] = $params->quality;490 491 if ($params->quality > $common_quality and $tpl_var['enabled'])492 {493 $common_quality = $params->quality;494 }495 487 } 496 488 $tpl_vars[$type]=$tpl_var; 497 489 } 498 490 $template->assign('derivatives', $tpl_vars); 499 $template->assign('resize_quality', $common_quality);491 $template->assign('resize_quality', ImageStdParams::$quality); 500 492 } 501 493 -
trunk/admin/include/configuration_sizes_process.inc.php
r14221 r14649 98 98 $errors[$type]['w'] = '>0'; 99 99 } 100 100 101 101 $h = intval($pderivative['h']); 102 102 if ($h <= 0) … … 104 104 $errors[$type]['h'] = '>0'; 105 105 } 106 106 107 107 if (max($w,$h) <= $prev_w) 108 108 { … … 117 117 $errors[$type]['w'] = '>'.$prev_w; 118 118 } 119 119 120 120 $v = intval($pderivative['h']); 121 121 if ($v <= 0 or $v <= $prev_h) … … 124 124 } 125 125 } 126 126 127 127 if (count($errors) == 0) 128 128 { … … 130 130 $prev_h = intval($pderivative['h']); 131 131 } 132 133 $v = intval($pderivative['sharpen']); 134 if ($v<0 || $v>100) 135 { 136 $errors[$type]['sharpen'] = '[0..100]'; 137 } 132 138 } 133 139 … … 135 141 if (count($errors) == 0) 136 142 { 143 $quality_changed = ImageStdParams::$quality != intval($_POST['resize_quality']); 144 ImageStdParams::$quality = intval($_POST['resize_quality']); 145 137 146 $enabled = ImageStdParams::get_defined_type_map(); 138 147 $disabled = @unserialize( @$conf['disabled_derivatives'] ); … … 146 155 { 147 156 $pderivative = $pderivatives[$type]; 148 157 149 158 if ($pderivative['enabled']) 150 159 { … … 156 165 ) 157 166 ); 158 159 $new_params->quality = intval($_POST['resize_quality']); 160 167 $new_params->sharpen = intval($pderivative['sharpen']); 168 161 169 ImageStdParams::apply_global($new_params); 162 170 163 171 if (isset($enabled[$type])) 164 172 { … … 170 178 $same = false; 171 179 } 172 180 173 181 if ($same 174 182 and $new_params->sizing->max_crop != 0 … … 177 185 $same = false; 178 186 } 179 180 if ($new_params->quality != $old_params->quality) 187 188 if ($quality_changed 189 || $new_params->sharpen != $old_params->sharpen) 181 190 { 182 191 $same = false; 183 192 } 184 193 185 194 if (!$same) 186 195 { … … 210 219 } 211 220 } 212 221 213 222 $enabled_by = array(); // keys ordered by all types 214 223 foreach(ImageStdParams::get_all_types() as $type) … … 219 228 } 220 229 } 221 230 222 231 ImageStdParams::set_and_save($enabled_by); 223 232 if (count($disabled) == 0) … … 231 240 } 232 241 $conf['disabled_derivatives'] = serialize($disabled); 233 242 234 243 if (count($changed_types)) 235 244 { 236 245 clear_derivative_cache($changed_types); 237 246 } 238 247 239 248 array_push( 240 249 $page['infos'], … … 257 266 } 258 267 } 259 268 260 269 $template->assign('derivatives', $pderivatives); 261 270 $template->assign('ferrors', $errors); -
trunk/admin/include/image.class.php
r13882 r14649 288 288 static function get_sharpen_matrix($amount) 289 289 { 290 // Amount should be in the range of 28-10291 $amount = round(abs(- 28 + ($amount * 0.18)), 2);290 // Amount should be in the range of 48-10 291 $amount = round(abs(-48 + ($amount * 0.38)), 2); 292 292 293 293 $matrix = array( … … 550 550 function rotate($rotation) 551 551 { 552 if ($rotation==90 || $rotation==270) 553 { 554 $tmp = $this->width; 555 $this->width = $this->height; 556 $this->height = $tmp; 557 } 552 558 $this->add_command('rotate', -$rotation); 553 559 $this->add_command('orient', 'top-left'); … … 563 569 function resize($width, $height) 564 570 { 565 $this->add_command('interlace', 'line');566 571 $this->add_command('filter', 'Lanczos'); 567 572 $this->add_command('resize', $width.'x'.$height.'!'); … … 596 601 function write($destination_filepath) 597 602 { 603 $this->add_command('interlace', 'line'); // progressive rendering 604 598 605 $exec = $this->imagickdir.'convert'; 599 606 $exec .= ' "'.realpath($this->source_filepath).'"'; … … 612 619 @exec($exec, $returnarray); 613 620 614 //echo($exec); 621 ilog($exec); 622 if (is_array($returnarray) && (count($returnarray)>0) ) 623 { 624 ilog($returnarray); 625 } 615 626 return is_array($returnarray); 616 627 } -
trunk/admin/themes/default/template/configuration.tpl
r14548 r14649 432 432 </tr> 433 433 {/if} 434 <tr> 435 <td>{'Sharpen'|@translate}</td> 436 <td> 437 <input type="text" name="d[{$type}][sharpen]" maxlength="4" size="4" value="{$d.sharpen}"{if isset($ferrors.$type.sharpen)} class="dError"{/if}> 438 % 439 {if isset($ferrors.$type.sharpen)}<span class="dErrorDesc" title="{$ferrors.$type.sharpen}">!</span>{/if} 440 </td> 441 </tr> 434 442 </table> {* #sizeEdit *} 435 443 </td> -
trunk/i.php
r13864 r14649 583 583 } 584 584 585 $image->set_compression_quality( $params->quality );585 $image->set_compression_quality( ImageStdParams::$quality ); 586 586 $image->write( $page['derivative_path'] ); 587 587 $image->destroy(); -
trunk/include/derivative_params.inc.php
r14221 r14649 241 241 public $sizing; 242 242 public $sharpen = 0; 243 public $quality = 95;244 243 245 244 function __construct($sizing) … … 250 249 public function __sleep() 251 250 { 252 return array('last_mod_time', 'sizing', 'sharpen' , 'quality');251 return array('last_mod_time', 'sizing', 'sharpen'); 253 252 } 254 253 -
trunk/include/derivative_std_params.inc.php
r14581 r14649 52 52 private static $watermark; 53 53 public static $custom = array(); 54 public static $quality=95; 54 55 55 56 static function get_all_types() … … 110 111 self::$custom = @$arr['c']; 111 112 if (!self::$custom) self::$custom = array(); 113 if (isset($arr['q'])) self::$quality = $arr['q']; 112 114 } 113 115 else … … 115 117 self::$watermark = new WatermarkParams(); 116 118 self::$type_map = self::get_default_sizes(); 119 self::save(); 117 120 } 118 121 self::build_maps(); … … 137 140 $ser = serialize( array( 138 141 'd' => self::$type_map, 142 'q' => self::$quality, 139 143 'w' => self::$watermark, 140 144 'c' => self::$custom, -
trunk/language/en_UK/admin.lang.php
r14648 r14649 918 918 $lang['%d second'] = '%d second'; 919 919 $lang['%d seconds'] = '%d seconds'; 920 $lang['Sharpen'] = 'Sharpen'; 920 921 ?>
Note: See TracChangeset
for help on using the changeset viewer.