contra10 Posted January 6, 2009 Share Posted January 6, 2009 hey i need to resize an image that is already inserted into mysql my code so far is <?php $id = 2; if(!isset($id) || empty($id)){ die("Please select your image!"); }else{ $query = mysql_query('SELECT * FROM `tbl_images` WHERE `id`= "'.$id.'"'); $row = mysql_fetch_assoc($query); $content = $row['image']; header('Content-type: ' . $row['type'] .''); print $content; } ?> where should i start the image resize... or am i going about wrong and i should resize the image before i inject it into mysql Quote Link to comment https://forums.phpfreaks.com/topic/139623-solved-resizing-an-image/ Share on other sites More sharing options...
premiso Posted January 6, 2009 Share Posted January 6, 2009 imagecopyresized Unsure of how to use it from an image coming out of the DB, but that would be the function/documentation on what you would want to use... Quote Link to comment https://forums.phpfreaks.com/topic/139623-solved-resizing-an-image/#findComment-730488 Share on other sites More sharing options...
contra10 Posted January 6, 2009 Author Share Posted January 6, 2009 do u know if it is possible im trying stuff but nothing works Quote Link to comment https://forums.phpfreaks.com/topic/139623-solved-resizing-an-image/#findComment-730500 Share on other sites More sharing options...
DarkWater Posted January 6, 2009 Share Posted January 6, 2009 Load it into GD with imagecreatefromstring() and then use normal resizing procedure. Quote Link to comment https://forums.phpfreaks.com/topic/139623-solved-resizing-an-image/#findComment-730501 Share on other sites More sharing options...
contra10 Posted January 6, 2009 Author Share Posted January 6, 2009 should i start off like that $id = 2; if(!isset($id) || empty($id)){ die("Please select your image!"); }else{ $query = mysql_query('SELECT * FROM `tbl_images` WHERE `id`= "'.$id.'"'); $row = mysql_fetch_assoc($query); $content = $row['image']; header('Content-type: ' . $row['type'] .''); $newimage = imagecreatefromstring($content); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/139623-solved-resizing-an-image/#findComment-730506 Share on other sites More sharing options...
contra10 Posted January 6, 2009 Author Share Posted January 6, 2009 a Quote Link to comment https://forums.phpfreaks.com/topic/139623-solved-resizing-an-image/#findComment-730577 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.