Jump to content

Searching for code


Wstar

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!
Link to comment
https://forums.phpfreaks.com/topic/24576-searching-for-code/
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");
}
[/code]
Link to comment
https://forums.phpfreaks.com/topic/24576-searching-for-code/#findComment-112005
Share on other sites

Archived

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

×
×
  • Create New...

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.