Example #1
0
 function _flipGif()
 {
     $source = ImagecreateFromGif($this->_source);
     $width = imagesx($source);
     $height = imagesy($source);
     $image = ImageCreateTrueColor($width, $height);
     if ($this->_hori) {
         for ($i = 0; $i < $width; $i++) {
             ImageCopyResampled($image, $source, $width - $i - 1, 0, $i, 0, 1, $height, 1, $height);
         }
         if ($this->_vert) {
             ImageCopyResampled($source, $image, 0, 0, 0, 0, $width, $height, $width, $height);
         }
     }
     if ($this->_vert) {
         for ($i = 0; $i < $height; $i++) {
             ImageCopyResampled($image, $source, 0, $height - $i - 1, 0, $i, $width, 1, $width, 1);
         }
     }
     ImageDestroy($source);
     $result = ImageGif($image, $this->_target);
     ImageDestroy($image);
     return $result;
 }
Example #2
0
 /**
  * Internal function for resizing gif images.
  * @return Bool true or false depending on success or not.
  */
 function _resizeGif()
 {
     $source = ImagecreateFromGif($this->_source);
     $image = ImageCreate($this->_width, $this->_height);
     //imagealphablending($thumbnail, true);
     //imagesavealpha($thumbnail,true);
     $transparent = imagecolorallocate($image, 255, 255, 255);
     imagefilledrectangle($image, 0, 0, $this->_width, $this->_height, $transparent);
     imagecolortransparent($image, $transparent);
     ImageCopyResampled($image, $source, 0, 0, 0, 0, $this->_width, $this->_height, ImageSX($source), ImageSY($source));
     $result = ImageGif($image, $this->_target);
     ImageDestroy($image);
     ImageDestroy($source);
     return $result;
 }