Ejemplo n.º 1
0
 static function originalToResized($fileName, $width, $height, $quality, $crop, $rotation, $round, $roundFill, $watermark = 0, $wmText = '', $wmTextColor = '', $wmTextSize = '', $wmFilename = '', $wmPosition = '', $wmTrans = 100, $filesize = 0, $refresh = true)
 {
     $increment = igFileHelper::getIncrementFromFilename($fileName);
     $folderName = igFileHelper::getFolderName($increment);
     $fullFileName = igFileHelper::makeFileName($fileName, $width, $height, $quality, $crop, $rotation, $round, $roundFill, $watermark, $wmPosition, $wmTrans, $wmText, $wmTextColor, $wmTextSize, $wmFilename);
     $sourceFile = IG_ORIG_PATH . '/' . $folderName . '/' . $fileName;
     $destFile = IG_RESIZE_PATH . '/' . $folderName . '/' . $fullFileName;
     if (!JFile::exists($destFile)) {
         if (!JFile::exists($sourceFile)) {
             igFileHelper::raiseError('The source file: ' . $sourceFile . ' does not exist, please delete/reupload this image.', $refresh);
             return true;
         }
         igFileHelper::makeFolder(IG_RESIZE_PATH . '/' . $folderName);
         if (!igFileHelper::makeImage($sourceFile, $destFile, $width, $height, $quality, $refresh, $crop, $rotation, $round, $roundFill, $watermark, $wmText, $wmTextColor, $wmTextSize, $wmFilename, $wmPosition, $wmTrans)) {
             return false;
         }
     }
     $imgSize = getimagesize($destFile);
     if (empty($imgSize[0]) || empty($imgSize[1])) {
         igFileHelper::raiseError('Error: the image dimensions of the file ' . $destFile . ' can not be read, please delete/reupload this image.', $refresh);
         return true;
     }
     $fileArray = array();
     $fileArray['fullFileName'] = $fullFileName;
     $fileArray['folderName'] = $folderName;
     $fileArray['width'] = $imgSize[0];
     $fileArray['height'] = $imgSize[1];
     if ($filesize == 1) {
         $size = filesize($destFile);
         $fileArray['filesize'] = $size;
     }
     return $fileArray;
 }