Jump to content

GD ImageJPEG Question


Ducky

Recommended Posts

I'm currently running a script to upload an image and store it as a blob in the database. This works fine, so the next step of progression for this script was to continue by getting the script to resize the image and then upload it to the DB too.

 

$thumb = @ImageCreateTrueColor ($this->w, $this->h);

@ImageCopyResampled ($thumb, $im, 0, 0, 0, 0, $this->w, $this->h, $original_width, $original_height);

ob_start();

@ImageJPEG ($thumb);

$bufferoutput = ob_get_contents();

ob_end_clean();

$image = addslashes($bufferoutput);

 

As you can see from this, I've been using the buffer to put the smaller image into a variable for upload later. This method seems somewhat "dirty" to me and i was wondering if there is a way to upload the data generated from imageJPEG directly instead.

 

Anyway, I would really appreceate or advice, even if its might not be what I want to hear, as at least then I can stop second guessing myself over it.

 

Thanks In advance.

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.