invert() public method

Invert
public invert ( ) : SimpleImage
return SimpleImage
Beispiel #1
0
 /**
  * Verify and validate the extension of the uploaded file.
  *
  * @param string $name
  * @param string $type
  * @return boolean
  */
 public function validateSponsorImage($name, $tmpName, $type)
 {
     $allowedExtensions = array("gif", "jpeg", "jpg", "png", "pdf", "GIF", "JPEG", "JPG", "PNG", "PDF");
     $temp = explode(".", $name);
     $extension = end($temp);
     if (($type === "image/gif" || $type === "image/jpeg" || $type === "image/jpg" || $type === "image/pjpeg" || $type === "image/x-png" || $type === "image/png" || $type === "application/pdf") && in_array($extension, $allowedExtensions)) {
         $img = new SimpleImage($tmpName);
         $img->fit_to_width(360);
         $img->invert();
         $img->crop(0, ($img->get_height() - 190) / 2, 360, ($img->get_height() - 190) / 2 + 190);
         $img->invert();
         $img->save("_temp/_img.png");
         return true;
     } else {
         return false;
     }
 }