class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
I'm testing this now and I got it working fine if I for example upload a gif and convert it to a jpg.
BUT ... Next test I have problem with. I don't want the images saved as a files, I just want to convert uploaded images to jpg and then store it in a variable for later insert into a db. I assume jpg at average gives smallest images to save into my db... FYI ... I will be using this in my users gallery area ... I had all image files saved on disk before, but I'm changing to store images in db now ...
Anyway, when I test using the code below, and upload a gif it looks like the resulting image is a huge bmp ... Not a jpg ... At least that's what I get when I right click and saving it ... Any idea what I'm doing wrong and what I should do?
if ($handle->uploaded) {
$handle->file_new_name_body = 'image_resized';
$handle->image_convert = 'jpg'; // We only want jpg's saved into db ...
$handle->image_resize = true;
$handle->image_x = 255;
$handle->image_ratio_y = true;
$handle->jpeg_quality = 80;
$handle->Process('./images/upload/');
$image = $handle->Process();
if ($handle->processed) {
header('Content-type: ' . $handle->file_src_mime);
echo $image;
} else {
echo 'error : ' . $handle->error;
}
}
BUT ... Next test I have problem with.
I don't want the images saved as a files, I just want to convert uploaded images to jpg and then store it in a variable for later insert into a db. I assume jpg at average gives smallest images to save into my db... FYI ... I will be using this in my users gallery area ... I had all image files saved on disk before, but I'm changing to store images in db now ...
Anyway, when I test using the code below, and upload a gif it looks like the resulting image is a huge bmp ... Not a jpg ... At least that's what I get when I right click and saving it ... Any idea what I'm doing wrong and what I should do?