开发者

Resize image in PHP from blob in mysql

I have a large image I want to resize while keep开发者_高级运维ing the proportions


   $blob = mysql_fetch_...();

   $gd = imagecreatefromstring($blob);
   $resized = imagecreatetruecolor(X, Y); // new image dimensions
   imagecopyresampled(....);

   ob_start();
   imagejpeg($resized);
   $new_blob = ob_get_clean();

   mysql_query(... update table ...);


There are innumerable image resize scripts out there (google keywords: php thumbnailer). Alternatively roll your own using GD. Load the blob into a string, and use the imagecreatefromstring() function to create the image.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜