简体   繁体   English

在MySQL中从Blob调整PHP中的图像大小

[英]Resize image in PHP from blob in mysql

我想放大图像,但要保持比例不变

   $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). 那里有无数的图片调整脚本(Google关键字:php thumbnailer)。 Alternatively roll your own using GD. 也可以使用GD自己滚动。 Load the blob into a string, and use the imagecreatefromstring() function to create the image. 将Blob加载到字符串中,然后使用imagecreatefromstring()函数创建图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM