|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Database Discussion Forum This is the place to find help resolving those nagging questions you have about implementing and using all kinds of databases. Need help writing a query? Need an opinion on Oracle? Post here! |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
my prob.:iam getting image from database
but not able to convert that image(resize taht is). Warning: getimagesize: Unable to open 'ÿØÿá›Exif' for reading. in c:\apache\htdocs\upload\sho1.php on line 19 my php code: / database connection $conn = mysql_connect("localhost") OR DIE (mysql_error()); @mysql_select_db ("beebaho", $conn) OR DIE (mysql_error()); $sql = "SELECT * FROM images WHERE Id=4"; $result = mysql_query ($sql, $conn); if (mysql_num_rows ($result)>0) { $row = @mysql_fetch_array ($result); $image_type = $row["image_type"]; global $maxH,$maxW,$image,$imgInfo,$imgwidth,$imgheight; $image = $row["pic"]; // echo $image; $imgInfo= getimagesize($image); $imgwidth = $imgInfo[0]; $imgheight = $imgInfo[1]; $maxW=200; $maxH=300; if ($imgwidth > $maxW) { $ration = $maxW/$imgwidth; $newwidth = round($imgwidth*$ration); $newheight = round($imgheight*$ration); if ($newheight > $maxH) { $ration = $maxH/$newheight; $newwidth = round($newwidth*$ration); $newheight = round($newheight*$ration); return array("image" => $image, "width" => $newwidth, "height" => $newheight); echo $image; } else { return array("image" => $image, "width" => $newwidth, "height" => $newheight); echo $image; } } else if ($imgheight > $maxH) { $ration = $maxH/$imgheight; $newwidth = round($imgwidth*$ration); $newheight = round($imgheight*$ration); if ($newwidth > $maxW) { $ration = $maxW/$newwidth; $newwidth = round($newwidth*$ration); $newheight = round($newheight*$ration); return array("image" => $image, "width" => $newwidth, "height" => $newheight); echo $image; } else { return array("image" => $image, "width" => $newwidth, "height" => $newheight); echo $image; } } else { return array("image" => $image, "width" => $newwidth, "height" => $newheight); echo $image; } // Header ("Content-type: $image_type"); echo $image; } ?> if comment "$imgInfo= getimagesize($image);" and "echo $image;" then it works but image is very large
__________________
The impossible doesnot Exist! |
|
||||
|
I hope the image path you have specified in the database match with the actually path of the image..
and 2nd thing... in that warning..why it is not displaying the image ext? are u stroing image name without ext or something? Deep
__________________
Deep Ganatra Gifts to India - Cisco Certification Training - CSS Based Website Design |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2010 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |