Monday, 15 March 2010

PHP Thumbnail from image from url -



PHP Thumbnail from image from url -

i'm using code, first checks filenames in folder , creates url. in url find special line imagefile. displays correctly image , address, if images big, takes long time. possible create thumbnail , display instead of image? give thanks you!

require_once('simple_html_dom.php'); $files = scandir('files/'); foreach($files $file) { if($file == '.' || $file == '..') continue; $file = basename($file, ".html"); $url = 'http://address.com/test/'.$file; $html = file_get_html($url); foreach($html->find('img') $element) { if (strpos($element,'address.com') !== false) { $url = $element->src; echo $url.'</br>'; echo '<img src="',$url, '" width="128" height="96" border="0" alt="" /><br/>'; } } }

you want utilize css clip:rect(50px 218px 155px 82px);

setting width , height not decress actual image size, load time still take long. see article on step step div creation , css coding.

http://www.seifi.org/css/creating-thumbnails-using-the-css-clip-property.html

also side note, nil beats making tumbnails! there serve side thumbnail generators, best you'll out making tumbnails.

php image url thumbnails

No comments:

Post a Comment