Ejemplo n.º 1
0
 function resizeImage($filename)
 {
     $image = tulipIP::loadImage($this->imgDir . $filename);
     $dest = $this->imgDir . "thumbs/";
     $resized = tulipIP::resize($image, 250, TIP_FIXED);
     if (tulipIP::getMime($this->imgDir . $filename) == "image/jpeg") {
         $mime = TIP_JPG;
     } elseif (tulipIP::getMime($this->imgDir . $filename) == "image/png") {
         $mime = TIP_PNG;
     } elseif (tulipIP::getMime($this->imgDir . $filename) == "image/jpg") {
         $mime = TIP_JPG;
     }
     tulipIP::saveImage($dest, $resized, $mime, substr($filename, 0, -4));
     imagedestroy($resized);
     /*
             $thumbnail = tulipIP::loadImage($this->imgDir..$filename);
             $copy = tulipIP::gdClone($thumbnail);
             tulipIP::Gblur($copy, 1);
             tulipIP::saveImage($dest, $copy, $mime, substr($filename,0,-4));
             imagedestroy($copy);
     */
 }
Ejemplo n.º 2
0
imagedestroy($resized);
// resize image with the given height(150) and let tulipIP handle the new width (aspect ratio)
$resized = tulipIP::resize($image, TIP_FIXED, 150);
tulipIP::saveImage($dest, $resized, TIP_PNG, "FIXED-150");
imagedestroy($resized);
/**
 * resize image with the given width(100) and let tulipIP keep original height
 * You can also do the following
 * $resized = tulipIP::resize($image, 100,tulipIP::getHeight($image));
 */
$resized = tulipIP::resize($image, 100, TIP_CURRENT);
tulipIP::saveImage($dest, $resized, TIP_PNG, "100-original");
imagedestroy($resized);
/**
 * resize image with the given height(150) and let tulipIP keep original width
 * You can also do the following
 * $resized = tulipIP::resize($image, tulipIP::getWidth($image),150);
 */
$resized = tulipIP::resize($image, TIP_CURRENT, 150);
tulipIP::saveImage($dest, $resized, TIP_PNG, "original-150");
imagedestroy($resized);
/**
 * Note: if the params ($new_width,$new_height) were one of this states :
 * TIP_FIXED TIP_FIXED
 * TIP_FIXED TIP_CURRENT
 * TIP_CURRENT TIP_FIXED
 * TIP_CURRENT TIP_CURRENT
 * a copy of given gd resource will be returned with no modifition
 */
// destroy the source
imagedestroy($image);