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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.