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.
more info about the class
$sort = 1; foreach ($files as $file) { $handle = new Upload($file); if ($handle->file_is_image && $handle->image_src_x > 399) { if ($handle->uploaded) { $handle->image_watermark = IMAGES . 'watermark.png'; $handle->image_watermark_position = 'TBLR'; $handle->jpeg_quality = 75; $handle->image_convert = 'jpg'; $big = $handle->file_new_name_body = 'big_' . time(); if ($handle->image_src_x > 772) { $handle->image_resize = true; $handle->image_ratio_y = true; $handle->image_x = 773; } $handle->Process($dir_dest); $big_width = $handle->image_dst_x; $big_height = $handle->image_dst_y; // create thumbnail $handle->jpeg_quality = 75; $handle->image_convert = 'jpg'; $thumb = $handle->file_new_name_body = 'thumb_' . time(); $handle->image_resize = true; $handle->image_ratio_crop = true; $handle->image_x = 100; $handle->image_y = 100; $handle->Process($dir_dest); $db->query("INSERT INTO ads_images SET img_aid = '" . (int) $ad_id . "', img_uid = '" . (int) $user->user_id . "', img_big = '" . $db->escape($big) . ".jpg', img_bigx = '" . (int)$big_width . "', img_bigy = '" . (int)$big_height . "', img_thumb = '" . $db->escape($thumb) . ".jpg', img_sort = '" . (int) $sort . "' "); $sort++; $handle->Clean(); } } }
User upload image & class will given a name to big_image.jpg and thumb_image.jpg. If single upload image it will store correctly to database.
But when multiple image, thumb_ & big_ will stored incorrect into database. Here a part of code for re-size, upload & store into db.
May I know a mistake here