Nim*_*007 15
我使用这个简单的1功能来完成所有工作
看看这个 :
http://www.nimrodstech.com/php-image-resize/
https://github.com/Nimrod007/PHP_image_resize
[此示例] 是您正在寻找的imagecopyresampled。
<?php
// The file
$filename = 'test.jpg';
$percent = 0.5;
// Content type
header('Content-Type: image/jpeg');
// Get new dimensions
list($width, $height) = getimagesize($filename);
$new_width = $width * $percent;
$new_height = $height * $percent;
// Resample
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
// Output
imagejpeg($image_p, null, 100);
?>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
26399 次 |
| 最近记录: |