Wstar Posted October 20, 2006 Share Posted October 20, 2006 I've been all over the net trying to find what I need. Everything didn't work.I'm trying to store images in a Mysql database.Once its store, i need to display it. All this I can do, but.I'm having problems resizing the image before its displayed. Every bit of code I get that relates to resizing an image it ask for a directory where the image is located. What is the directory if i'm storing them on database?I'm very comfused. If anyone has or knows where I can get the code to do this, PLEASE LET ME KNOW! Link to comment https://forums.phpfreaks.com/topic/24576-searching-for-code/ Share on other sites More sharing options...
jvrothjr Posted October 20, 2006 Share Posted October 20, 2006 I resize my images when they are uploaded and store both the full size and the thumbnail in the DB.I use the thumbnail to display and once they select the thumb nail the full size is downloaded.when the upload the file via php page there is a true file that is set to a variable and loaded into the DB just resize at that point before it is dumped to the DB[code=php:0]function thumb_jpeg($image_name,$source_path,$destination_path){//Create Thumbnail $new_width=150; //Image width Change if needed $new_height=150; //Image height Change if needed $destimg=ImageCreate($new_width,$new_height) or die("Problem In Creating image"); $srcimg=ImageCreateFromjpeg($source_path.$image_name) or die("Problem In opening Source Image"); ImageCopyResized($destimg,$srcimg,0,0,0,0,$new_width,$new_height,ImageSX($srcimg),ImageSY($srcimg)) or die("Problem In resizing"); Imagejpeg($destimg,$destination_path.$image_name) or die("Problem In saving");}[/code] Link to comment https://forums.phpfreaks.com/topic/24576-searching-for-code/#findComment-112005 Share on other sites More sharing options...
fenway Posted October 22, 2006 Share Posted October 22, 2006 If you're storing them in the DB, which is a questionable practice, then there is no "path"... you need to serve this images directly. Link to comment https://forums.phpfreaks.com/topic/24576-searching-for-code/#findComment-112773 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.