简体   繁体   中英

Get image width and height of image in blob

I have some images in a MySQL Database, each stored in BLOB fields. How can I evaluate the width and height of the images in pixels?

Let's say you have retrieved the image from the blob field in the database via a mysqli_query and assigned it variable $image . You can use this code:

$im = imagecreatefromstring($image);
$width = imagesx($im);
$height = imagesy($im);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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