473,387 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problem with thumbnail generator

37
I am trying to run a script that generates thumbnail images of websites.
When I run the script I get the following error message.

Fatal error: Class 'COM' not found in /home/online/public/tutor/thumb.php on line 9

If I run the script locally I do not get the error,
however what I do see is a thumbnail image with a black background.

This is the script

Expand|Select|Wrap|Line Numbers
  1. function thumb_image($img_file,$url)
  2. {
  3. //** initiate a browser session for screen capture
  4. $browser = new COM("InternetExplorer.Application");
  5. $handle = $browser->HWND;
  6. $browser->Visible = true;
  7. $browser->Fullscreen = true;
  8. $browser->Navigate($url);
  9.  
  10. while ($browser->Busy) {
  11.     com_message_pump(4000);
  12. }
  13. sleep(1);
  14.  
  15. $im = imagegrabscreen(); //** works only with IE, captures the whole screen
  16. $browser->Quit();
  17. imagepng($im, "tmp_".$img_file); //** store workfile
  18.  
  19. $percent = 0.20;   //** factor of thumbnail reduction = 20%
  20. list($width, $height) = getimagesize("tmp_".$img_file);
  21. $new_width = floor($width * $percent);
  22. $new_height = floor($height * $percent);
  23.  
  24. //// Resample
  25. $im2 = imagecreatetruecolor($new_width, $new_height);
  26. imagecopyresampled($im2, $im, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
  27.  
  28. imagepng($im2, $img_file); //** save url image into specified file_name
  29. imagedestroy($im); imagedestroy($im2);
  30. }
  31.  
  32. thumb_image("facebook.png","http://www.google.co.uk"); 
  33. //** call the function
  34. print "<img src=facebook.png>"; echo "<br><br>";       
  35. //** use captured image like any regular picture
Sep 24 '11 #1
0 1309

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: shay | last post by:
if anyone have a good idea about how to creat an html to image component i tried : A. capture a web browser controll prob 1. a win form app , we need to put the web controll inside A dll file....
1
by: Johnny | last post by:
Hello, I am looking for someone to guide me in the right direction. What I want to do is take a "screenshot" of a web page programatically as IE sees it, using C#? I had previosuly used the...
8
by: Chris Dewin | last post by:
Hi. I run a website for my band, and the other guys want an image gallery. I'm thinking it would be nice and easy, if we could just upload a jpg into a dir called "gallery/". When the client...
0
by: Vicky | last post by:
HI , i have made a thumbnail generator webservice. Its free and anyone can access it from http://www.indiaresult.com/webservice/thumbnailgenerator.asmx Vicky
10
by: David | last post by:
Greetings all, I am having a problem with an asp.net application using C# which is a thumbnail generator. Here is the code used... http://www.eggheadcafe.com/articles/20030515.asp It works...
7
by: oscartheduck | last post by:
Hi folks, I'm trying to alter a program I posted about a few days ago. It creates thumbnail images from master images. Nice and simple. To make sure I can match all variations in spelling of...
8
by: Arno R | last post by:
Hi all. When I need to search for pictures, I always have too choose thumbnail-view manually. Is it possible to open the common dialog in thumbnail-view programmatically? Example ?? At the...
0
by: Maric Michaud | last post by:
I faced a strange behavior with generator expression, which seems like a bug, for both python 2.4 and 2.5 : .... a = 1, 2, 3 .... b = 1, 2, 3 .... C = list((e,f) for e in a for f...
7
by: flamer die.spam | last post by:
Hi all, I have a new website im setting up, its a large image archive, I have it setup to open a folder, go through and for each file in that folder check a /tn sub-folder for a matching name, if...
2
by: Gunasegar | last post by:
Greeting to all am trying to create thumbnail from image stored in mysql database.. this is the coding am using to create the thumbnail... this works like charm.. but the problem is that the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.