public function setImage($file) {

		if(false === is_string($file)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($file)), E_USER_ERROR);
		}

		if(false === is_file($file)) {
			return trigger_error(sprintf('File "%s" passed to %s() does not exists', $file, __METHOD__), E_USER_ERROR);
		}

		if(false === is_readable($file)) {
			return trigger_error(sprintf('File "%s" passed to %s() is not readable', $file, __METHOD__), E_USER_ERROR);
		}

		$info = @getimagesize($file);

		if(false === is_array($info) || count($info) < 3) {
			return trigger_error(sprintf('File "%s" passed to %s() is not an image', $file, __METHOD__), E_USER_ERROR);
		}

		$this -> image 	 	= @imagecreatefromstring(file_get_contents($file));
		$this -> extension 	= pathinfo($file, PATHINFO_EXTENSION);

		return $this;
	}
public function setImage($file) {

		if(false === is_string($file)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($file)), E_USER_ERROR);
		}

		if(false === is_file($file)) {
			return trigger_error(sprintf('File "%s" passed to %s() does not exists', $file, __METHOD__), E_USER_ERROR);
		}

		if(false === is_readable($file)) {
			return trigger_error(sprintf('File "%s" passed to %s() is not readable', $file, __METHOD__), E_USER_ERROR);
		}

		$info = @getimagesize($file);

		if(false === is_array($info) || count($info) < 3) {
			return trigger_error(sprintf('File "%s" passed to %s() is not an image', $file, __METHOD__), E_USER_ERROR);
		}

		$this -> image 	 	= @imagecreatefromstring(file_get_contents($file));
		$this -> extension 	= pathinfo($file, PATHINFO_EXTENSION);

		return $this;
	}
public function setImage ( $ file ) { if ( false === is_string ( $ file ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ file ) ) , E_USER_ERROR ) ; } if ( false === is_file ( $ file ) ) { return trigger_error ( sprintf ( 'File "%s" passed to %s() does not exists' , $ file , __METHOD__ ) , E_USER_ERROR ) ; } if ( false === is_readable ( $ file ) ) { return trigger_error ( sprintf ( 'File "%s" passed to %s() is not readable' , $ file , __METHOD__ ) , E_USER_ERROR ) ; } $ info = @ getimagesize ( $ file ) ; if ( false === is_array ( $ info ) || count ( $ info ) < 3 ) { return trigger_error ( sprintf ( 'File "%s" passed to %s() is not an image' , $ file , __METHOD__ ) , E_USER_ERROR ) ; } $ this -> image = @ imagecreatefromstring ( file_get_contents ( $ file ) ) ; $ this -> extension = pathinfo ( $ file , PATHINFO_EXTENSION ) ; return $ this ; }
Set a new image
@param string $image
@return sFire\Image\Image
Set a new image