daily pastebin goal
88%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public function setImages($file)
  2.     {
  3.         $tmpImage = tempnam(sys_get_temp_dir(), 'img');
  4.         $tmpThumb = tempnam(sys_get_temp_dir(), 'thumb');
  5.  
  6.         $newImage = new \Imagick();
  7.         if ($newImage->readImage($file))
  8.         {
  9.             $newThumb = $newImage->clone();
  10.             $newThumb->cropThumbnailImage(50, 50);
  11.             $newThumb->writeImage($tmpThumb);
  12.  
  13.             $this->setThumbnail($tmpThumb);
  14.  
  15.             $newImage->resizeImage(400, 400, \Imagick::FILTER_LANCZOS, 1);
  16.             $newImage->writeImage($tmpImage);
  17.  
  18.             $this->setFile($tmpImage);
  19.         }
  20.         else
  21.         {
  22.             echo 'error reading the file: ';die();
  23.         }
  24.        
  25.         return $tmpImage;
  26.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top