Code snippets for symfony 1.x

Navigation

Refine Tags

Snippets tagged "sfwebbrowserplugin"

download images with sfWebBrowserPlugin

Download an image via sfWebBrowser and save it as-is or turn it into a thumbnail.

$b = new sfWebBrowser();
$b->get('http://foo/images/bar.gif');
 
// create thumbnail
$thumb = new sfThumbnail(150, 150);
$thumb->loadData($b->getResponseText(), $b->getResponseHeader('Content-Type'));
$thumb->save('/home/foo/bar.gif');
 
// just store the file - don't make thumbnail
file_put_contents('/home/foo/bar.gif', $b->getResponseText());
 
by Benjamin Meynell on 2007-09-15, tagged sfthumbnailplugin  sfwebbrowserplugin