/* find the "desired height" of this thumbnail, relative to the desired width */ $desired_height = floor($height * ($desired_width / $width)); /* create a new, "virtual" image */ $virtual_image = imagecreatetruecolor($desired_width, $desired_height); /* copy source image at a resized size */ imagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $desired_width, $desired_height, $width, $height); /* create the physical thumbnail image to its destination */ imagejpeg($virtual_image, $dest); //---------------------------------- $image_list .= $upload->file_copy . ','; $session->setHotelImageUploadList($image_list); $hotels = new Hotels(); $hotels->setHotelId($hotel_file_id); $hotels->extractor($hotels->getHotelFromId()); $hotel_img = $hotels->hotelsImages(); //$img_list = ""; if ($hotel_img != '') { $hotel_img .= ',' . $upload->file_copy; $hotels->updateHotelsImages($hotel_img); //$img_list = $hotel_img; } else { $hotels->updateHotelsImages($upload->file_copy); //$img_list = $upload->file_copy;