Results 1 to 5 of 5

Thread: script for adding thumbshots to my directory

  1. #1
    Join Date
    Sep 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default script for adding thumbshots to my directory

    Hi Every one

    I would like to add thumbshots of websites that are registered on my Directory

    creativelads.in

    I wish to have a automatic thumbshot creation upon submitting the website by the end user, so as to make the listing more attractive.

    My web directory is for web designer ,graphic designer who wish to register and showcase their portfolio
    Last edited by jscheuer1; 09-24-2010 at 09:51 AM. Reason: remove unnecessary hot link

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I forget where I found this, and I added quite a bit to it. It requires a windows server with IE installed, PHP 5.2.2 or greater with GD and Image Functions. You also have to enable the server* to do this:

    PHP Code:
    <?php
    $nav 
    = isset($_GET['nav'])? $_GET['nav'] : 'http://www.google.com/';
    $browser = new COM("InternetExplorer.Application");
    $handle $browser->HWND;
    $browser->Visible true;
    $browser->Fullscreen true;
    $browser->Navigate($nav);
    $dest imagecreatetruecolor(144107);

    /* Still working? */
    while ($browser->ReadyState!=4usleep(10000);
    $im imagegrabwindow($handle0);
    $browser->Quit();
    imagecopyresampled($dest$im00001441071007748); // 1007px × 748px
    header('Content-type: image/gif');

    imagegif($dest);
    imagedestroy($im);
    imagedestroy($dest);
    ?>
    It outputs the actual image. But you could as easily have it save it to a file.

    Problem is that it times out sometimes, in which case you get a blank image (perhaps now solved with new code for /* Still working? */).

    Notes: The 1007px x 748px comment is a reminder of the dimensions of my server's virtual screen and appears in the line for which it is a comment. The two values just before that are the size of the thumbnail, they should be proportional to the server's virtual screen size, but otherwise can be dimensions of your choosing. To determine the size of the virtual screen save the $im image to a file and open it in any program that will give you its dimensions.

    To write to a file, skip the header and give the filename in the imagegif command, ex:

    PHP Code:
    imagegif($dest'imsnap.gif'); 

    * To enable the server:

    services -> [name of the server, like Apache for example] -> LoginTab -> Allow to interact with desktop

    You can also edit the registry for this, varies by Windows version.
    Last edited by jscheuer1; 09-24-2010 at 11:31 AM. Reason: more info/improvements
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Sep 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    You an also use a Webservice like fadeout.de

    More details (in german) at http://fadeout.de/details.php

    CU
    Michael
    Last edited by jscheuer1; 09-24-2010 at 11:33 AM. Reason: remove broken link

  4. #4
    Join Date
    Sep 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks guys,for the update , i would play around to see, if i can fix it with JOHN's post

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I know it's a lot to take in at once, but I have this working under wamp under windows 7 home. So I know it's possible even without a full blown windows server. So, if you have any questions, let me know.

    This also means that if your host isn't setup properly and they are unwilling to allow the changes required, that you can set this up on your local machine and all you would need is communication between it and the live host. If you are not looking for real time results, this could probably even be a cron job on the local machine that takes mail that was sent to it from the live host to get the URL's. In which case you could tell people that it could take up to 12 hours or whatever for the thumbnail to appear. I'm not up on all that communication part, but I'm pretty sure it's possible.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •