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
https://forums.phpfreaks.com/topic/96525-gd-imagejpeg-question/
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.