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.
精彩评论