protected function ensureResource()
	{
		if ($this->resource === null)
		{
			$path = $this->image->getPathname();
			// if valid image type, make corresponding image resource
			switch ($this->image->imageType)
			{
				case IMAGETYPE_GIF:
					$this->resource = imagecreatefromgif($path);
					break;
				case IMAGETYPE_JPEG:
					$this->resource = imagecreatefromjpeg($path);
					break;
				case IMAGETYPE_PNG:
					$this->resource = imagecreatefrompng($path);
					break;
			}
		}
	}
protected function ensureResource()
	{
		if ($this->resource === null)
		{
			$path = $this->image->getPathname();
			// if valid image type, make corresponding image resource
			switch ($this->image->imageType)
			{
				case IMAGETYPE_GIF:
					$this->resource = imagecreatefromgif($path);
					break;
				case IMAGETYPE_JPEG:
					$this->resource = imagecreatefromjpeg($path);
					break;
				case IMAGETYPE_PNG:
					$this->resource = imagecreatefrompng($path);
					break;
			}
		}
	}
protected function ensureResource ( ) { if ( $ this -> resource === null ) { $ path = $ this -> image -> getPathname ( ) ; // if valid image type, make corresponding image resource switch ( $ this -> image -> imageType ) { case IMAGETYPE_GIF : $ this -> resource = imagecreatefromgif ( $ path ) ; break ; case IMAGETYPE_JPEG : $ this -> resource = imagecreatefromjpeg ( $ path ) ; break ; case IMAGETYPE_PNG : $ this -> resource = imagecreatefrompng ( $ path ) ; break ; } } }
Make the image resource object if needed
Make the image resource object if needed