Creating Thumbnail of WebPages using WebThumb API

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

  1. Pingback: PHPDeveloper.org
  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 useful.it’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 http://webthumb.bluga.net/ section user.
    i replace this api number into your script in usage.php and img.ph $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. Trying to save the image of the thumb rather than display it. So do not have to keep getting the image everytime.

    Can you tell me how todo this?

    imagejpeg function maybe?

  5. @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.

  6. 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.

  7. 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 🙂

  8. 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 domain1.com.jpeg, domain2.com.jpeg 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

    Thanks
    John

  9. 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}”;

    thanks!

  10. I mean…

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

  11. 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.

  12. 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.

  13. 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 comment