setImage(PATH_TMP.'original'.'.'.$fileExtension, '400', '400', 'crop'); $Image->saveImage(PATH_UPLOADS_PROFILES.$tmpName, 100, false, true); } // --- OTHERS --- else { // Generate the thumbnail $Image = new Image(); //Handling all other formats than svg if (strcasecmp($fileExtension, 'svg') != 0) { $Image->setImage(PATH_TMP.'original'.'.'.$fileExtension, THUMBNAILS_WIDTH, THUMBNAILS_HEIGHT, 'crop'); $Image->saveImage(PATH_UPLOADS_THUMBNAILS.$tmpName, 100, true); } // Move the original to the upload folder. rename(PATH_TMP.'original'.'.'.$fileExtension, PATH_UPLOADS.$tmpName); //If it is a svg file, just save a copy in thumbnail-folder if (strcasecmp($fileExtension, 'svg') == 0) { copy(PATH_UPLOADS.$tmpName, PATH_UPLOADS_THUMBNAILS.$tmpName); } } // Remove the Bludit temporary file. if(file_exists(PATH_TMP.'original'.'.'.$fileExtension)) { unlink(PATH_TMP.'original'.'.'.$fileExtension); } exit(json_encode(array( 'status'=>0, 'filename'=>$tmpName ))); ?>