Example #1
0
        $this->path = $path;
        list($this->width, $this->height) = getimagesize($path);
    }
    protected function lazyLoad()
    {
        if ($this->realImage == null) {
            $this->realImage = new RawImage($this->path);
        }
    }
    /**
     * @return string
     */
    public function dump()
    {
        $this->lazyLoad();
        return $this->realImage->dump();
    }
}
class Client
{
    public function tag(Image $img)
    {
        return "<img src = \"{$img->getPath()}\" alt=\"\" width=\"{$img->getWidth()}\" height=\"{$img->getHeight()}\" />";
    }
}
$path = '/path/to/the/file';
$client = new Client();
$image = new RawImage($path);
echo $client->tag($image), "\n";
$proxy = new ImageProxy($path);
echo $client->tag($proxy);