开发者

thumbnail generator using php code so to take scrrenshot of webpages

开发者 https://www.devze.com 2023-01-16 16:41 出处:网络
Actually I am running a wesite www.webmaggu.com which is mainly a directory of variou interesting links and websites which are submitted by users. I want to generate thumbnails beside the links. So tr

Actually I am running a wesite www.webmaggu.com which is mainly a directory of variou interesting links and websites which are submitted by users. I want to generate thumbnails beside the links. So tried webnapr, picoshot and many others but they don't give free thumbnails for longer days. so I want to generate my开发者_如何学编程 own thumbnail generator. I have seem various codes using IE capt on websites but I don't know why they are not working on my website www.webmaggu.com Actually my hosting provider is linux based but they say they have GDI running on different servers which supports both linux and windows users...

so if any body can help with codes or some links .....


Under windows it's pretty easy. You need to enable gd in your php.ini file. You do that by removing the ; on the follow line:

extension=php_gd2.dll

Then use the following code:

<?php
$ie = new COM("InternetExplorer.Application") or die("Unable to instanciate Internet Explorer");
$ie->Navigate2("http://www.digeshops.com");
$ie->Visible = true;
while ($ie->ReadyState!=4) usleep(200);
$handle = $ie->HWND;
$img = imagegrabwindow($handle);
$ie->Quit();
imagepng($img,"screenGrap.png");
?>


If you want a 100% standalone solution for taking screenshots of websites, there is a project called khtml2png

It requires no external webservice and renders a webpage using the Konquerer engine under Linux. it should be pretty easy to install, depending on your Linux server distro.


Hi shashank

See something interesting here

10 Free Website Thumbnail Generation Services

http://www.neurosoftware.ro/wp/elvis/php/10-free-website-thumbnail-generation-services/

i will say , you to check http://www.thumbalizr.com/ coz there is api. using php you can generate and store info in db as if needed.

Some API based useful resource

  • http://webshotspro.com/
  • http://www.websnapr.com/
  • http://webthumb.bluga.net/home
  • http://quickthumbnail.com/


I think you should use a freeware hosted on your Linux.

For example (googled it) : http://code.google.com/p/webthumb/

It uses Mozilla for generating thumbnails.

Good Luck !


You mentioned above that you can't install djano on your shared hosting account, which probably means you can't install any of the solutions mentioned here, let alone install something you've written yourself.

The way I see it you have 2 solutions:

1) With a bit of hacking you could create the thumbnails automatically on your home PC, and FTP them to your hosting account.

2) Read the Terms of Use for the free services you're using. There's a good chance they're blocking you. I'd suggest caching the thumbnails locally, and serving them from your server instead of hot linking them.

0

精彩评论

暂无评论...
验证码 换一张
取 消