Changeset 12956 for trunk/admin/include/image.class.php
- Timestamp:
- Jan 24, 2012, 10:50:47 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/image.class.php
r12922 r12956 42 42 43 43 function resize($width, $height); 44 44 45 45 function sharpen($amount); 46 46 47 47 function compose($overlay, $x, $y, $opacity); 48 48 … … 97 97 { 98 98 $starttime = get_moment(); 99 99 100 100 // width/height 101 101 $source_width = $this->image->get_width(); … … 119 119 120 120 $this->image->set_compression_quality($quality); 121 121 122 122 if ($strip_metadata) 123 123 { … … 130 130 $this->image->crop($resize_dimensions['crop']['width'], $resize_dimensions['crop']['height'], $resize_dimensions['crop']['x'], $resize_dimensions['crop']['y']); 131 131 } 132 132 133 133 $this->image->resize($resize_dimensions['width'], $resize_dimensions['height']); 134 134 … … 183 183 } 184 184 } 185 185 186 186 $ratio_width = $width / $max_width; 187 187 $ratio_height = $height / $max_height; 188 $destination_width = $width; 188 $destination_width = $width; 189 189 $destination_height = $height; 190 190 191 191 // maximal size exceeded ? 192 192 if ($ratio_width > 1 or $ratio_height > 1) 193 193 { 194 194 if ($ratio_width < $ratio_height) 195 { 195 { 196 196 $destination_width = round($width / $ratio_height); 197 197 $destination_height = $max_height; 198 198 } 199 199 else 200 { 201 $destination_width = $max_width; 200 { 201 $destination_width = $max_width; 202 202 $destination_height = round($height / $ratio_width); 203 203 } … … 233 233 return null; 234 234 } 235 235 236 236 if (!function_exists('exif_read_data')) 237 237 { … … 240 240 241 241 $rotation = null; 242 242 243 243 $exif = exif_read_data($source_filepath); 244 244 245 245 if (isset($exif['Orientation']) and preg_match('/^\s*(\d)/', $exif['Orientation'], $matches)) 246 246 { … … 275 275 array(-1, -1, -1), 276 276 ); 277 277 278 278 $norm = array_sum(array_map('array_sum', $matrix)); 279 279 … … 432 432 return $this->image->convolveImage($m); 433 433 } 434 434 435 435 function compose($overlay, $x, $y, $opacity) 436 436 { 437 // todo 438 return false; 437 $ioverlay = $overlay->image->image; 438 /*if ($ioverlay->getImageAlphaChannel() !== Imagick::ALPHACHANNEL_OPAQUE) 439 { 440 // Force the image to have an alpha channel 441 $ioverlay->setImageAlphaChannel(Imagick::ALPHACHANNEL_OPAQUE); 442 }*/ 443 444 global $dirty_trick_xrepeat; 445 if ( !isset($dirty_trick_xrepeat) && $opacity < 100) 446 {// NOTE: Using setImageOpacity will destroy current alpha channels! 447 $ioverlay->evaluateImage(Imagick::EVALUATE_MULTIPLY, $opacity / 100, Imagick::CHANNEL_ALPHA); 448 $dirty_trick_xrepeat = true; 449 } 450 451 return $this->image->compositeImage($ioverlay, Imagick::COMPOSITE_DISSOLVE, $x, $y); 439 452 } 440 453 … … 525 538 { 526 539 $m = pwg_image::get_sharpen_matrix($amount); 527 540 528 541 $param ='convolve "'.count($m).':'; 529 542 foreach ($m as $line) … … 536 549 return true; 537 550 } 538 551 539 552 function compose($overlay, $x, $y, $opacity) 540 553 { … … 564 577 $exec .= ' "'.realpath($dest['dirname']).'/'.$dest['basename'].'"'; 565 578 @exec($exec, $returnarray); 566 579 567 580 //echo($exec); 568 581 return is_array($returnarray); … … 686 699 return imageconvolution($this->image, $m, 1, 0); 687 700 } 688 701 689 702 function compose($overlay, $x, $y, $opacity) 690 703 { … … 695 708 $ow = imagesx($ioverlay); 696 709 $oh = imagesy($ioverlay); 697 710 698 711 // Create a new blank image the site of our source image 699 712 $cut = imagecreatetruecolor($ow, $oh);
Note: See TracChangeset
for help on using the changeset viewer.