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;
 }
Ejemplo n.º 2
0
define('IG_IMAGE_HTML_WATERMARK', JURI::root(true) . '/images/igallery/watermark/');
define('IG_IMAGE_ASSET_PATH', JURI::root(true) . '/media/com_igallery/images/');
$igJVersion = new JVersion();
if ($igJVersion->isCompatible('3.0')) {
    define('IG_J30', true);
} else {
    define('IG_J30', false);
}
define('IG_VERSION', '3.6.7');
//import some classes
jimport('joomla.environment.uri');
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
require_once IG_ADMINISTRATOR_COMPONENT . '/helpers/html.php';
require_once IG_ADMINISTRATOR_COMPONENT . '/helpers/file.php';
require_once IG_ADMINISTRATOR_COMPONENT . '/helpers/upload.php';
require_once IG_ADMINISTRATOR_COMPONENT . '/helpers/general.php';
require_once IG_ADMINISTRATOR_COMPONENT . '/helpers/tree.php';
require_once IG_ADMINISTRATOR_COMPONENT . '/helpers/static.php';
require_once IG_COMPONENT . '/helpers/utility.php';
require_once IG_ADMINISTRATOR_COMPONENT . '/models/base.php';
if (!IG_J30) {
    require_once JPATH_LIBRARIES . '/joomla/application/web/webclient.php';
}
//make the base folders if needed
igFileHelper::makeFolder(IG_IMAGE_PATH);
igFileHelper::makeFolder(IG_TEMP_PATH);
igFileHelper::makeFolder(IG_ORIG_PATH);
igFileHelper::makeFolder(IG_RESIZE_PATH);
igFileHelper::makeFolder(IG_WATERMARK_PATH);