コード例 #1
0
ファイル: image.lib.php プロジェクト: jijkoun/ssscrape
 /**
  * Load an image from a file. This method tries to detect the filetype
  * automatically and will abort if the automatic detection failed.
  *
  * \param $filename
  *   Filename of the image to load.
  *
  * \return
  *   A new AnewtImage instance
  */
 public static function from_file($filename)
 {
     assert('is_string($filename)');
     if (AnewtImage::_filename_looks_like_png($filename)) {
         $img = AnewtImage::from_png($filename);
     } elseif (AnewtImage::_filename_looks_like_jpeg($filename)) {
         $img = AnewtImage::from_jpeg($filename);
     } else {
         trigger_error(sprintf('AnewtImage::from_file(): Cannot load image, filename "%s" does not have a supported extension', $filename), E_USER_ERROR);
     }
     return $img;
 }
コード例 #2
0
ファイル: image.test.php プロジェクト: jijkoun/ssscrape
 /** Crop image */
 static function crop()
 {
     $img = AnewtImage::from_png('test.png');
     $img->crop(50, 60, 400, 200);
     $img->flush_png();
     $img->destroy();
 }