Creating Thumbnail of WebPages using WebThumb API

42 thoughts on “Creating Thumbnail of WebPages using WebThumb API”

  1. Pingback:
  2. I just wanted to say thanks to Hasin for writing this wrapper its great.

    On Chris’s comment, yes its a possibliblity, there are two options. One is too get a pdf plugin working on my setup (though im not sure if that works or not). The other would be too integrate a pdf library into the rendering code. I’ll take a look at setting up a pdf plugin since thats pretty low effort.

  3. Hi, i’m a frenchy😉 thanks for you code very’s been a long time i was searching this kind of code to have thumbnails just putting an url in a field of a form.I’ve done all you said in your information to generate thumbnails.
    I took usage.php and Webthumb.class.php and img.php on my ftp server.
    I had my api number on section user.
    i replace this api number into your script in usage.php and $wb->setApi(“myapinumber….”);.
    After i launch usage.php , enter an url and nothing happens …
    Did i make a mistake? can you tell me ?
    Thanks a lot, and thanks for your very clever script.

  4. @wayne – no no, because wbGetThumbnail() already returns u the binary content. So All you need to do is just storing the content in a file. Use the following code

    file_put_contents($filename, $wb->getThumbnail($_GET[‘job_id’], “large”))

    Thats it.

  5. I was trying the webthumb on my localhost and it sure works, but when I uploaded and tested it on a web server (change mode of img.php to 777), no response or no thumbnail was created, could you please help on this sir hasin.

    This will be highly appreciated. Thank you very much.

  6. I noticed when enabled error_reporting, the private and public declaration could not be recognized so I removed it and came up with an error on simplexml_load_string() because this function does not exists on the class itself. Is this a new function from PHP. If not could you provide me the code on this, and if not I will try to create and mimick this function, trying to figure how🙂

  7. Great script!

    Is there a way to make this get multiple images (from multiple URLs at a time? Or feed it a list of URLs?
    And also to save them with filename, etc?

    Maybe I can just pass them the $url variable as $filename for that?

    Seems to me these changes would make it very useful for lots of people


  8. Good job!

    Hasin, there’s a simple bug:

    if (!empty($height))
    $requests = “{$height}”;
    if (!empty($width))
    $requests = “{$height}”;

    should be…

    if (!empty($height))
    $requests .= “{$height}”;
    if (!empty($width))
    $requests .= “{$height}”;


  9. I mean…

    if (!empty($height))
    $requests .= “{$height}”;
    if (!empty($width))
    $requests .= “{$width}”;

  10. Grate Work
    I need to save the file cause It will save a lot of resources when using this script, time even

    To save the content can I use the gd library. And I tried with the file_put_contents(“”,””) but it did not work.

  11. Is there a way to create thumbnails without using the api or an external server? I have been looking but I haven’t found anything that could easily work.

  12. Hasin,
    Just what I was looking for and something that needs to be Tweeted for sure. I appreciate the detail that you included to help people understand.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s