Jump to content


This topic is now archived and is closed to further replies.


Searching for code

Recommended Posts

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!

Share this post

Link to post
Share on other sites
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");

Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.