 |
|
Code
<?php
$filename = 'http://www.amoleflower.net/wp-content/uploads/2011/10/Flowers-3.jpg';
$new_width = 200;
list($width, $height) = getimagesize($filename);
$new_height = round(($height * $new_width) / $width);
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
header('Content-type: image/jpeg');
imagejpeg($image_p, null, 100);
imageDestroy($image_p);
?>
ทำยังไงให้โค้ด resize นี้ โชว์ได้หลายๆ รูปในหน้าเดียวกันอะครับ
คือผมไม่อยากได้ resize แบบต้องเซฟ เลยใช้โค้ดนี้ แต่ทำยังไงๆ มันก็โชว์ได้แค่รูปเดียว ....
ขอบคุณครับ
Tag : PHP, CakePHP
|
|
 |
 |
 |
 |
Date :
2011-12-04 10:46:53 |
By :
sudtua |
View :
867 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |