|
@@ 272-296 (lines=25) @@
|
| 269 |
|
$imageCopyfunction = (function_exists('ImageCopyResampled') && 'gd2' === $this->_image_type) ? 'imagecopyresampled' : 'imagecopyresized'; |
| 270 |
|
|
| 271 |
|
switch ($this->_img_info[2]) { |
| 272 |
|
case 1: |
| 273 |
|
// GIF image |
| 274 |
|
$img = function_exists('imagecreatefromgif') ? imagecreatefromgif($this->_source_image) : imagecreatefrompng($this->_source_image); |
| 275 |
|
$tmp_img = $imageCreateFunction($newWidth, $newHeight); |
| 276 |
|
$imageCopyfunction($tmp_img, $img, 0, 0, 0, 0, $newWidth, $newHeight, $this->_img_info[0], $this->_img_info[1]); |
| 277 |
|
if (function_exists('imagegif')) { |
| 278 |
|
imagegif($tmp_img, $this->_save_image); |
| 279 |
|
} else { |
| 280 |
|
imagepng($tmp_img, $this->_save_image); |
| 281 |
|
} |
| 282 |
|
imagedestroy($tmp_img); |
| 283 |
|
break; |
| 284 |
|
|
| 285 |
|
case 2: |
| 286 |
|
// echo $this->_save_image; |
| 287 |
|
$img = function_exists('imagecreatefromjpeg') ? imagecreatefromjpeg($this->_source_image) : imagecreatefrompng($this->_source_image); |
| 288 |
|
$tmp_img = $imageCreateFunction($newWidth, $newHeight); |
| 289 |
|
$imageCopyfunction($tmp_img, $img, 0, 0, 0, 0, $newWidth, $newHeight, $this->_img_info[0], $this->_img_info[1]); |
| 290 |
|
if (function_exists('imagejpeg')) { |
| 291 |
|
imagejpeg($tmp_img, $this->_save_image, $this->img_quality); |
| 292 |
|
} else { |
| 293 |
|
imagepng($tmp_img, $this->_save_image); |
| 294 |
|
} |
| 295 |
|
imagedestroy($tmp_img); |
| 296 |
|
break; |
| 297 |
|
|
| 298 |
|
case 3: |
| 299 |
|
// PNG image |
|
@@ 285-309 (lines=25) @@
|
| 282 |
|
imagedestroy($tmp_img); |
| 283 |
|
break; |
| 284 |
|
|
| 285 |
|
case 2: |
| 286 |
|
// echo $this->_save_image; |
| 287 |
|
$img = function_exists('imagecreatefromjpeg') ? imagecreatefromjpeg($this->_source_image) : imagecreatefrompng($this->_source_image); |
| 288 |
|
$tmp_img = $imageCreateFunction($newWidth, $newHeight); |
| 289 |
|
$imageCopyfunction($tmp_img, $img, 0, 0, 0, 0, $newWidth, $newHeight, $this->_img_info[0], $this->_img_info[1]); |
| 290 |
|
if (function_exists('imagejpeg')) { |
| 291 |
|
imagejpeg($tmp_img, $this->_save_image, $this->img_quality); |
| 292 |
|
} else { |
| 293 |
|
imagepng($tmp_img, $this->_save_image); |
| 294 |
|
} |
| 295 |
|
imagedestroy($tmp_img); |
| 296 |
|
break; |
| 297 |
|
|
| 298 |
|
case 3: |
| 299 |
|
// PNG image |
| 300 |
|
$img = imagecreatefrompng($this->_source_image); |
| 301 |
|
$tmp_img = $imageCreateFunction($newWidth, $newHeight); |
| 302 |
|
$imageCopyfunction($tmp_img, $img, 0, 0, 0, 0, $newWidth, $newHeight, $this->_img_info[0], $this->_img_info[1]); |
| 303 |
|
imagepng($tmp_img, $this->_save_image); |
| 304 |
|
imagedestroy($tmp_img); |
| 305 |
|
break; |
| 306 |
|
default: |
| 307 |
|
return false; |
| 308 |
|
} |
| 309 |
|
if (1 == $this->_return_fullpath) { |
| 310 |
|
return $this->_source_url . "/{$this->_img_savepath}/{$savefile}"; |
| 311 |
|
} else { |
| 312 |
|
return "{$this->_img_savepath}/{$savefile}"; |