loadString() публичный Метод

Load an image
public loadString ( string $imageString, boolean | null $strict = false )
$imageString string Binary images
$strict boolean | null
Пример #1
0
 public function testPHP53_getimagesizefromstring()
 {
     try {
         $img = new Image();
         $img->loadString('R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
     } catch (Exception $e) {
         isTrue(strpos(PHP_VERSION, '5.3') === 0);
     }
 }
Пример #2
0
 /**
  * @requires PHP 5.4
  */
 public function testInvalidImageString()
 {
     try {
         $img = new Image();
         $img->loadString('__INVALID__', true);
     } catch (Exception $e) {
         isTrue($e->getMessage() === 'Invalid image source.');
     }
     try {
         $img = new Image('__INVALID__', true);
     } catch (Exception $e) {
         isTrue($e->getMessage() === 'Invalid image source.');
     }
 }