feha Posted March 11, 2008 Share Posted March 11, 2008 I do have stored images in mySQL blob field's. I can display image by using: function blob2image ($item_id = "03-07-12", $image_mode = "s") { //by feha $image = ''; $db = new clsDBcms(); $image = CCDLookUp("Picture_Small", "items", "No=". $db->ToSQL(trim($item_id), ccsText), $db); $db->close(); if(strlen($image)) { //list($width, $height, $type, $attr) = $image; //This part don't work ok ?! header ("Content-Type: image/jpeg"); echo $image; } } Is there any way to get this info ? Note: list($width, $height, $type, $attr) = getimagesize($image); don't work on this string ... Link to comment https://forums.phpfreaks.com/topic/95702-get-image-size-and-info-from-blob-mysql/ Share on other sites More sharing options...
KrisNz Posted March 11, 2008 Share Posted March 11, 2008 getimagesize only works on files, not raw data. You can use imagecreatefromstring() to recreate the image as a resource, then use functions like imagesx(),imagesy() image_type_to_extension() to get those bits of information. But if you need that information it would make more sense to store it in the database when you first save the image, since that will save you a lot of overhead. Link to comment https://forums.phpfreaks.com/topic/95702-get-image-size-and-info-from-blob-mysql/#findComment-490005 Share on other sites More sharing options...
feha Posted September 3, 2008 Author Share Posted September 3, 2008 Hi Thank you a bit late respond from my side. I usually store sizes in to tb table but i got a DB from client with images (blob). I think the only way is to make temp image file as cache and read from there. Link to comment https://forums.phpfreaks.com/topic/95702-get-image-size-and-info-from-blob-mysql/#findComment-632783 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.