コード例 #1
0
 /**
  * Do the actual resize of an image
  *
  * @param Asido_TMP &$tmp
  * @param integer $width
  * @param integer $height
  * @return boolean
  * @access protected
  */
 function __resize(&$tmp, $width, $height)
 {
     return imagick_resize($tmp->target, $width, $height, IMAGICK_FILTER_UNKNOWN, 0);
 }
コード例 #2
0
ファイル: Imagick2.php プロジェクト: joeymetal/v1
 /**
  * Resize Action
  *
  * @param int   $new_x   New width
  * @param int   $new_y   New height
  * @param mixed $options Optional parameters
  *
  * @return bool|PEAR_Error TRUE or PEAR_Error object on error
  * @access protected
  */
 function _resize($new_x, $new_y, $options = null)
 {
     if (!imagick_resize($this->imageHandle, $new_x, $new_y, IMAGICK_FILTER_UNKNOWN, 1)) {
         return $this->raiseError('Couldn\'t resize image.', IMAGE_TRANSFORM_ERROR_FAILED);
     }
     $this->new_x = $new_x;
     $this->new_y = $new_y;
     return true;
 }
コード例 #3
0
function bilder($width,$height,$dest) {
	//Wenn auf dem Server die php_imagick nicht installiert werden kann:
        //$rc=@exec("/usr/bin/convert -resize ".$width."x".$height." tmp/tmp.file_org tmp/tmp.file_$dest",$aus,$rc2);
        //if ($rc2>0) { echo "[Bildwandeln: $image.$dest]<br>";  return false; };

	if (!function_exists("imagick_readimage")) { echo "Imagick-Extention nicht installiert"; return false; };
	$handle=imagick_readimage("./tmp/tmp.file_org");
	if (!$handle) {
		$reason      = imagick_failedreason( $handle ) ;
		print "Lesen: $reason<BR>\n" ; flush();
		return false;
	}
	if (!imagick_resize( $handle, $width, $height, IMAGICK_FILTER_UNKNOWN, 0)) {
		$reason      = imagick_failedreason( $handle ) ;
		print "Resize: $reason<BR>\n" ;	flush();
		return false;
	}
	if (!imagick_writeimage( $handle,"./tmp/tmp.file_$dest")) {
		$reason      = imagick_failedreason( $handle ) ;
		print "Schreiben: $reason<BR>\n" ; 	flush();
		return false;
	}
	return true;
}
コード例 #4
0
function _image_creer_vignette($valeurs, $maxWidth, $maxHeight, $process = 'AUTO', $force = false, $test_cache_only = false)
{
    // ordre de preference des formats graphiques pour creer les vignettes
    // le premier format disponible, selon la methode demandee, est utilise
    $image = $valeurs['fichier'];
    $format = $valeurs['format_source'];
    $destdir = dirname($valeurs['fichier_dest']);
    $destfile = basename($valeurs['fichier_dest'], "." . $valeurs["format_dest"]);
    $format_sortie = $valeurs['format_dest'];
    // liste des formats qu'on sait lire
    $img = isset($GLOBALS['meta']['formats_graphiques']) ? strpos($GLOBALS['meta']['formats_graphiques'], $format) !== false : false;
    // si le doc n'est pas une image, refuser
    if (!$force and !$img) {
        return;
    }
    $destination = "{$destdir}/{$destfile}";
    // chercher un cache
    $vignette = '';
    if ($test_cache_only and !$vignette) {
        return;
    }
    // utiliser le cache ?
    if (!$test_cache_only) {
        if ($force or !$vignette or @filemtime($vignette) < @filemtime($image)) {
            $creation = true;
            // calculer la taille
            if (($srcWidth = $valeurs['largeur']) && ($srcHeight = $valeurs['hauteur'])) {
                if (!($destWidth = $valeurs['largeur_dest']) || !($destHeight = $valeurs['hauteur_dest'])) {
                    list($destWidth, $destHeight) = _image_ratio($valeurs['largeur'], $valeurs['hauteur'], $maxWidth, $maxHeight);
                }
            } elseif ($process == 'convert' or $process == 'imagick') {
                $destWidth = $maxWidth;
                $destHeight = $maxHeight;
            } else {
                spip_log("echec {$process} sur {$image}");
                return;
            }
            // Si l'image est de la taille demandee (ou plus petite), simplement
            // la retourner
            if ($srcWidth and $srcWidth <= $maxWidth and $srcHeight <= $maxHeight) {
                $vignette = $destination . '.' . $format;
                @copy($image, $vignette);
            } else {
                if ($process == 'convert') {
                    define('_CONVERT_COMMAND', 'convert');
                    define('_RESIZE_COMMAND', _CONVERT_COMMAND . ' -quality ' . _IMG_CONVERT_QUALITE . ' -resize %xx%y! %src %dest');
                    $vignette = $destination . "." . $format_sortie;
                    $commande = str_replace(array('%x', '%y', '%src', '%dest'), array($destWidth, $destHeight, escapeshellcmd($image), escapeshellcmd($vignette)), _RESIZE_COMMAND);
                    spip_log($commande);
                    exec($commande);
                    if (!@file_exists($vignette)) {
                        spip_log("echec convert sur {$vignette}");
                        return;
                        // echec commande
                    }
                } else {
                    // imagick (php4-imagemagick)
                    if ($process == 'imagick') {
                        $vignette = "{$destination}." . $format_sortie;
                        $handle = imagick_readimage($image);
                        imagick_resize($handle, $destWidth, $destHeight, IMAGICK_FILTER_LANCZOS, _IMG_IMAGICK_QUALITE / 100);
                        imagick_write($handle, $vignette);
                        if (!@file_exists($vignette)) {
                            spip_log("echec imagick sur {$vignette}");
                            return;
                        }
                    } else {
                        // netpbm
                        if ($process == "netpbm") {
                            define('_PNMSCALE_COMMAND', 'pnmscale');
                            // chemin a changer dans mes_options
                            if (_PNMSCALE_COMMAND == '') {
                                return;
                            }
                            $vignette = $destination . "." . $format_sortie;
                            $pnmtojpeg_command = str_replace("pnmscale", "pnmtojpeg", _PNMSCALE_COMMAND);
                            if ($format == "jpg") {
                                $jpegtopnm_command = str_replace("pnmscale", "jpegtopnm", _PNMSCALE_COMMAND);
                                exec("{$jpegtopnm_command} {$image} | " . _PNMSCALE_COMMAND . " -width {$destWidth} | {$pnmtojpeg_command} > {$vignette}");
                                if (!($s = @filesize($vignette))) {
                                    spip_unlink($vignette);
                                }
                                if (!@file_exists($vignette)) {
                                    spip_log("echec netpbm-jpg sur {$vignette}");
                                    return;
                                }
                            } else {
                                if ($format == "gif") {
                                    $giftopnm_command = str_replace("pnmscale", "giftopnm", _PNMSCALE_COMMAND);
                                    exec("{$giftopnm_command} {$image} | " . _PNMSCALE_COMMAND . " -width {$destWidth} | {$pnmtojpeg_command} > {$vignette}");
                                    if (!($s = @filesize($vignette))) {
                                        spip_unlink($vignette);
                                    }
                                    if (!@file_exists($vignette)) {
                                        spip_log("echec netpbm-gif sur {$vignette}");
                                        return;
                                    }
                                } else {
                                    if ($format == "png") {
                                        $pngtopnm_command = str_replace("pnmscale", "pngtopnm", _PNMSCALE_COMMAND);
                                        exec("{$pngtopnm_command} {$image} | " . _PNMSCALE_COMMAND . " -width {$destWidth} | {$pnmtojpeg_command} > {$vignette}");
                                        if (!($s = @filesize($vignette))) {
                                            spip_unlink($vignette);
                                        }
                                        if (!@file_exists($vignette)) {
                                            spip_log("echec netpbm-png sur {$vignette}");
                                            return;
                                        }
                                    }
                                }
                            }
                        } else {
                            if ($process == 'gd1' or $process == 'gd2') {
                                if (_IMG_GD_MAX_PIXELS && $srcWidth * $srcHeight > _IMG_GD_MAX_PIXELS) {
                                    spip_log("vignette gd1/gd2 impossible : " . $srcWidth * $srcHeight . "pixels");
                                    return;
                                }
                                $destFormat = $format_sortie;
                                if (!$destFormat) {
                                    spip_log("pas de format pour {$image}");
                                    return;
                                }
                                $fonction_imagecreatefrom = $valeurs['fonction_imagecreatefrom'];
                                if (!function_exists($fonction_imagecreatefrom)) {
                                    return '';
                                }
                                $srcImage = @$fonction_imagecreatefrom($image);
                                if (!$srcImage) {
                                    spip_log("echec gd1/gd2");
                                    return;
                                }
                                // Initialisation de l'image destination
                                if ($process == 'gd2' and $destFormat != "gif") {
                                    $destImage = ImageCreateTrueColor($destWidth, $destHeight);
                                }
                                if (!$destImage) {
                                    $destImage = ImageCreate($destWidth, $destHeight);
                                }
                                // Recopie de l'image d'origine avec adaptation de la taille
                                $ok = false;
                                if ($process == 'gd2' and function_exists('ImageCopyResampled')) {
                                    if ($format == "gif") {
                                        // Si un GIF est transparent,
                                        // fabriquer un PNG transparent
                                        $transp = imagecolortransparent($srcImage);
                                        if ($transp > 0) {
                                            $destFormat = "png";
                                        }
                                    }
                                    if ($destFormat == "png") {
                                        // Conserver la transparence
                                        if (function_exists("imageAntiAlias")) {
                                            imageAntiAlias($destImage, true);
                                        }
                                        @imagealphablending($destImage, false);
                                        @imagesavealpha($destImage, true);
                                    }
                                    $ok = @ImageCopyResampled($destImage, $srcImage, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight);
                                }
                                if (!$ok) {
                                    $ok = ImageCopyResized($destImage, $srcImage, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight);
                                }
                                // Sauvegarde de l'image destination
                                $valeurs['fichier_dest'] = $vignette = "{$destination}.{$destFormat}";
                                $valeurs['format_dest'] = $format = $destFormat;
                                _image_gd_output($destImage, $valeurs);
                                if ($srcImage) {
                                    ImageDestroy($srcImage);
                                }
                                ImageDestroy($destImage);
                            }
                        }
                    }
                }
            }
        }
    }
    $size = @getimagesize($vignette);
    // Gaffe: en safe mode, pas d'acces a la vignette,
    // donc risque de balancer "width='0'", ce qui masque l'image sous MSIE
    if ($size[0] < 1) {
        $size[0] = $destWidth;
    }
    if ($size[1] < 1) {
        $size[1] = $destHeight;
    }
    $retour['width'] = $largeur = $size[0];
    $retour['height'] = $hauteur = $size[1];
    $retour['fichier'] = $vignette;
    $retour['format'] = $format;
    $retour['date'] = @filemtime($vignette);
    // renvoyer l'image
    return $retour;
}
コード例 #5
0
ファイル: shopimport_db.php プロジェクト: jquade/lxoffice-erp
function bilder($width, $height, $dest)
{
    if (!function_exists("imagick_readimage")) {
        echo "Imagick-Extention nicht installiert";
        return false;
    }
    $handle = imagick_readimage("./tmp/tmp.file_org");
    if (!$handle) {
        $reason = imagick_failedreason($handle);
        print "Lesen: {$reason}<BR>\n";
        flush();
        return false;
    }
    if (!imagick_resize($handle, $width, $height, IMAGICK_FILTER_UNKNOWN, 0)) {
        $reason = imagick_failedreason($handle);
        print "Resize: {$reason}<BR>\n";
        flush();
        return false;
    }
    if (!imagick_writeimage($handle, "./tmp/tmp.file_{$dest}")) {
        $reason = imagick_failedreason($handle);
        print "Schreiben: {$reason}<BR>\n";
        flush();
        return false;
    }
    return true;
}
コード例 #6
0
ファイル: incResize.php プロジェクト: voguegroup/moxhullmc
 function resize_file_IMagick(&$file, $create)
 {
     $handle = imagivk_readimage(getcwd() . '/' . $this->upload->path . '/' . $this->orgFileName);
     if (imagick_iserror($handle)) {
         $reason = imagick_failedreason($handle);
         $description = imagick_faileddescription($handle);
         echo "Handle failed!<br/>Reason: {$reason}<br/>Description: {$description}";
         exit;
     }
     if (!imagick_resize($handle, $this->newWidth, $this->newHeight, IMAGICK_FILTER_UNKNOWN, 0, "!")) {
         $reason = imagick_failedreason($handle);
         $description = imagick_faileddescription($handle);
         echo "imagick_resize() failed!<br/>Reason: {$reason}<br/>Description: {$description}";
         exit;
     }
     //Set the extension of the new file
     $ext = $this->GetNewfileExtension();
     if (file_exists($this->upload->path . '/' . $file->name . "." . $ext) && $file->name . "." . $ext != $file->fileName && $this->upload->nameConflict == "uniq") {
         $file->setFileName($this->upload->createUniqName($file->name . ".jpg"));
     }
     if ($create == "image") {
         $fileName = $file->name . "." . $ext;
         @unlink($this->upload->path . '/' . $this->orgFileName);
         if (!imagick_writeimage($handle, getcwd() . '/' . $this->upload->path . '/' . $fileName)) {
             $reason = imagick_failedreason($handle);
             $description = imagick_faileddescription($handle);
             echo "imagick_writeimage() failed!<br/>Reason: {$reason}<br/>Description: {$description}";
             exit;
         }
         $file->setFileName($fileName);
     } else {
         if ($this->pathThumb == "") {
             $this->pathThumb = $this->upload->path;
         }
         if ($this->naming == "suffix") {
             $fileName = $file->name . $this->suffix . "." . $ext;
         } else {
             $fileName = $this->suffix . $file->name . "." . $ext;
         }
         if (!imagick_writeimage($handle, getcwd() . '/' . $this->pathThumb . '/' . $fileName)) {
             $reason = imagick_failedreason($handle);
             $description = imagick_faileddescription($handle);
             echo "imagick_writeimage() failed!<br/>Reason: {$reason}<br/>Description: {$description}";
             exit;
         }
         $file->setThumbFileName($fileName, $this->pathThumb, $this->naming, $this->suffix);
     }
 }
コード例 #7
0
ファイル: file.php プロジェクト: Br3nda/mahara
/**
 * Given a path under dataroot, an ID and a size, return the path to a file
 * matching all criteria.
 *
 * If the file with the ID exists but not of the correct size, this function
 * will make a copy that is resized to the correct size.
 *
 * @param string $path The base path in dataroot where the image is stored. For 
 *                     example, 'artefact/file/profileicons/' for profile 
 *                     icons
 * @param int $id      The ID of the image to return. Is typically the ID of an 
 *                     artefact
 * @param mixed $size  The size the image should be.
 *
 *                      As a two element hash with 'w' and 'h' keys:
 *                     - If 'w' and 'h' are not empty, the image will be 
 *                       exactly that size
 *                     - If just 'w' is not empty, the image will be that wide, 
 *                       and the height will be set to make the image scale 
 *                       correctly
 *                     - If just 'h' is not empty, the image will be that high, 
 *                       and the width will be set to make the image scale 
 *                       correctly
 *                     - If neither are set or the parameter is not set, the 
 *                       image will not be resized
 *
 *                     As a number, the path returned will have the largest side being 
 *                     the length specified.
 * @return string The path on disk where the appropriate file resides, or false 
 *                if an appropriate file could not be located or generated
 */
function get_dataroot_image_path($path, $id, $size = null)
{
    $dataroot = get_config('dataroot');
    $imagepath = $dataroot . $path;
    if (substr($imagepath, -1) == '/') {
        $imagepath = substr($imagepath, 0, -1);
    }
    if (!is_dir($imagepath) || !is_readable($imagepath)) {
        return false;
    }
    // Work out the location of the original image
    $originalimage = $imagepath . '/originals/' . $id % 256 . "/{$id}";
    // If the original has been deleted, then don't show any image, even a cached one.
    // delete_image only deletes the original, not any cached ones, so we have
    // to make sure the original is still around
    if (!is_readable($originalimage)) {
        return false;
    }
    if (!$size) {
        // No size has been asked for. Return the original
        return $originalimage;
    } else {
        // Check if the image is available in the size requested
        $sizestr = serialize($size);
        $md5 = md5("{$id}.{$sizestr}");
        $resizedimagedir = $imagepath . '/resized/';
        check_dir_exists($resizedimagedir);
        for ($i = 0; $i <= 2; $i++) {
            $resizedimagedir .= substr($md5, $i, 1) . '/';
            check_dir_exists($resizedimagedir);
        }
        $resizedimagefile = "{$resizedimagedir}{$md5}.{$id}";
        //.$sizestr";
        if (is_readable($resizedimagefile)) {
            return $resizedimagefile;
        }
        // Image is not available in this size. If there is a base image for
        // it, we can make one however.
        if (is_readable($originalimage)) {
            $imageinfo = getimagesize($originalimage);
            $originalmimetype = $imageinfo['mime'];
            switch ($originalmimetype) {
                case 'image/jpeg':
                case 'image/jpg':
                    $oldih = imagecreatefromjpeg($originalimage);
                    break;
                case 'image/png':
                    $oldih = imagecreatefrompng($originalimage);
                    break;
                case 'image/gif':
                    $oldih = imagecreatefromgif($originalimage);
                    break;
                case 'image/bmp':
                case 'image/x-bmp':
                case 'image/ms-bmp':
                case 'image/x-ms-bmp':
                    if (!extension_loaded('imagick')) {
                        log_info('Bitmap image detected for resizing, but imagick extension is not available');
                        return false;
                    }
                    $ih = imagick_readimage($originalimage);
                    if (!($newdimensions = image_get_new_dimensions(imagick_getwidth($ih), imagick_getheight($ih), $size))) {
                        return false;
                    }
                    imagick_resize($ih, $newdimensions['w'], $newdimensions['h'], IMAGICK_FILTER_LANCZOS, 1);
                    if (imagick_writeimage($ih, $resizedimagefile)) {
                        return $resizedimagefile;
                    }
                    return false;
                default:
                    return false;
            }
            if (!$oldih) {
                return false;
            }
            $oldx = imagesx($oldih);
            $oldy = imagesy($oldih);
            if (!($newdimensions = image_get_new_dimensions($oldx, $oldy, $size))) {
                return false;
            }
            $newih = imagecreatetruecolor($newdimensions['w'], $newdimensions['h']);
            if ($originalmimetype == 'image/png' || $originalmimetype == 'image/gif') {
                // Create a new destination image which is completely
                // transparent and turn off alpha blending for it, so that when
                // the PNG source file is copied, the alpha channel is retained.
                // Thanks to http://alexle.net/archives/131
                $background = imagecolorallocate($newih, 0, 0, 0);
                imagecolortransparent($newih, $background);
                imagealphablending($newih, false);
                imagecopyresampled($newih, $oldih, 0, 0, 0, 0, $newdimensions['w'], $newdimensions['h'], $oldx, $oldy);
                imagesavealpha($newih, true);
            } else {
                // imagecopyresized is faster, but results in noticeably worse image quality.
                // Given the images are resized only once each time they're
                // made, I suggest you just leave the good quality one in place
                imagecopyresampled($newih, $oldih, 0, 0, 0, 0, $newdimensions['w'], $newdimensions['h'], $oldx, $oldy);
                //imagecopyresized($newih, $oldih, 0, 0, 0, 0, $newdimensions['w'], $newdimensions['h'], $oldx, $oldy);
            }
            $result = imagepng($newih, $resizedimagefile);
            if ($result) {
                return $resizedimagefile;
            }
        }
        // end attempting to build a resized image
    }
    // Image not available in any size
    return false;
}
コード例 #8
0
ファイル: getfax.php プロジェクト: chrlutz/limux-gosa
        while (!feof($sh)) {
            $data .= fread($sh, 4096);
        }
        pclose($sh);
        unlink($tmpfname);
    } else {
        /* Loading image */
        if (!($handle = imagick_blob2image($data))) {
            new log("view", "faxreport/faxreport", "", array(), "Cannot load fax image");
        }
        /* Converting image to PNG */
        if (!imagick_convert($handle, "PNG")) {
            new log("view", "faxreport/faxreport", "", array(), "Cannot convert fax image to png");
        }
        /* Resizing image to 420x594 and blur */
        if (!imagick_resize($handle, 420, 594, IMAGICK_FILTER_GAUSSIAN, 1)) {
            new log("view", "faxreport/faxreport", "", array(), "Cannot resize fax image");
        }
        /* Creating binary Code for the Image */
        if (!($data = imagick_image2blob($handle))) {
            new log("view", "faxreport/faxreport", "", array(), "Reading fax image image failed");
        }
    }
} else {
    /* force download dialog */
    header("Content-type: application/tiff\n");
    if (preg_match('/MSIE 5.5/', $HTTP_USER_AGENT) || preg_match('/MSIE 6.0/', $HTTP_USER_AGENT)) {
        header('Content-Disposition: filename="fax.tif"');
    } else {
        header('Content-Disposition: attachment; filename="fax.tif"');
    }
コード例 #9
0
ファイル: processor.imagick.php プロジェクト: kailIII/liberty
function liberty_imagick0_resize_image(&$pFileHash)
{
    global $gBitSystem;
    $pFileHash['error'] = NULL;
    $ret = NULL;
    if (!empty($pFileHash['source_file']) && is_file($pFileHash['source_file'])) {
        $iImg = imagick_readimage($pFileHash['source_file']);
        if (!$iImg) {
            // $pFileHash['error'] = $pFileHash['name'].' '.tra ( "is not a known image file" );
            $destFile = liberty_process_generic($pFileHash, FALSE);
        } elseif (imagick_iserror($iImg)) {
            // $pFileHash['error'] = imagick_failedreason( $iImg ) . imagick_faileddescription( $iImg );
            $destFile = liberty_process_generic($pFileHash, FALSE);
        } else {
            imagick_set_image_quality($iImg, $gBitSystem->getConfig('liberty_thumbnail_quality', 85));
            $iwidth = imagick_getwidth($iImg);
            $iheight = imagick_getheight($iImg);
            if ($iwidth / $iheight > 0 && !empty($pFileHash['max_width']) && !empty($pFileHash['max_height'])) {
                // we have a portrait image, flip everything
                $temp = $pFileHash['max_width'];
                $pFileHash['max_height'] = $pFileHash['max_width'];
                $pFileHash['max_width'] = $temp;
            }
            $itype = imagick_getmimetype($iImg);
            // override $mimeExt if we have a custom setting for it
            if ($gBitSystem->isFeatureActive('liberty_thumbnail_format')) {
                $mimeExt = $gBitSystem->getConfig('liberty_thumbnail_format');
            } else {
                list($type, $mimeExt) = explode('/', strtolower($itype));
            }
            if ($mimeExt = preg_replace("!^(x-)?(jpeg|png|gif)\$!", "\$2", $mimeExt)) {
                $targetType = $mimeExt;
                $destExt = '.' . $mimeExt;
            }
            if (!$mimeExt || $mimeExt == 'jpeg') {
                $targetType = 'jpeg';
                $destExt = '.jpg';
            }
            if (!empty($pFileHash['max_width']) && !empty($pFileHash['max_height']) && ($pFileHash['max_width'] < $iwidth || $pFileHash['max_height'] < $iheight || $mimeExt != $targetType)) {
                // We have to resize. *ALL* resizes are converted to jpeg or png
                if (!empty($pFileHash['dest_file'])) {
                    $destFile = $pFileHash['dest_file'];
                } else {
                    $destFile = STORAGE_PKG_PATH . $pFileHash['dest_branch'] . $pFileHash['dest_base_name'] . $destExt;
                }
                $pFileHash['name'] = $pFileHash['dest_base_name'] . $destExt;
                // print "			if ( !imagick_resize( $iImg, $pFileHash[max_width], $pFileHash[max_height], IMAGICK_FILTER_LANCZOS, 0.5, $pFileHash[max_width] x $pFileHash[max_height] > ) ) {";
                // Alternate Filter settings can seen here http://www.dylanbeattie.net/magick/filters/result.html
                if (!imagick_resize($iImg, $pFileHash['max_width'], $pFileHash['max_height'], IMAGICK_FILTER_CATROM, 1.0, '>')) {
                    $pFileHash['error'] .= imagick_failedreason($iImg) . imagick_faileddescription($iImg);
                }
                if (function_exists('imagick_set_attribute')) {
                    // this exists in the PECL package, but not php-imagick
                    $imagick_set_attribute($iImg, array("quality" => 1));
                }
                if (!imagick_writeimage($iImg, $destFile)) {
                    $pFileHash['error'] .= imagick_failedreason($iImg) . imagick_faileddescription($iImg);
                }
                $pFileHash['size'] = filesize($destFile);
            } else {
                // print "GENERIC";
                $destFile = liberty_process_generic($pFileHash, FALSE);
            }
        }
        $ret = $destFile;
    } else {
        $pFileHash['error'] = "No source file to resize";
    }
    return $ret;
}