$thumbnail2 = explode("x", $thumbnail2); if ($thumbnail2[0] > 0 && $thumbnail2[1] > 0) { $th2_pref_size = getPreferedSize($thumbnail2[0], $thumbnail2[1], $imagesize[0], $imagesize[1]); $thumbnail2_create = new ImageTools($upload_file_path); $thumbnail2_create->resizeNewByWidth($thumbnail2[0], $thumbnail2[1], $th2_pref_size[0], "#FFF"); $thumbnail2_create->save($album_path, "th2_{$new_name}", 100, true); } } // Create Defined Thumbnail 3 if ($thumbnail3 = $album['Thumbnail3Size']) { $thumbnail3 = explode("x", $thumbnail3); if ($thumbnail3[0] > 0 && $thumbnail3[1] > 0) { $th3_pref_size = getPreferedSize($thumbnail3[0], $thumbnail3[1], $imagesize[0], $imagesize[1]); $thumbnail3_create = new ImageTools($upload_file_path); $thumbnail3_create->resizeNewByWidth($thumbnail3[0], $thumbnail3[1], $th3_pref_size[0], "#FFF"); $thumbnail3_create->save($album_path, "th3_{$new_name}", 100, true); } } addImage($album_id, $upload_file_path); $last_id = mysql_insert_id(); $image = getImage($last_id); $image['errors'] = false; $image['thumbnailUrl'] = dirname($image['ImagePath']) . '/th_' . basename($image['ImagePath']); $json = json_encode($image); echo $json; } else { echo json_encode(array("errors" => "AlbumNotExists")); } } else { echo json_encode(array("errors" => "InvalidFileType")); }