Over the weekend Hansin wrote a PHP Webthumb API wrapper and released in under open source. Webthumb seems to be handling the load pretty well, its already generated 2600+ thumbnails today.
So if you want an easy way to generate webpage thumbnails right from your PHP applications now you have one.
I’ll be looking at some various rate limits and queue adjustments over the next week to keep one user from clogging up the queue too much. Until then be nice, and enjoy.
An awesome tool for easy going php developers. We love API and we love their good implementation. Good work Hasin !
The API doesn’t work:
Fatal error: Call to undefined method Job::quote() in /home/htdocs/jeichorn/bluga.net/webthumb/lib/Job.class.php on line 40
Thanks
Christian
Fixed sorry about that, i made a change and didn’t test things afterwards.
Hello, i’m a frenchy 😉 i found this script code on search engine.
It’s look so nice and adapted to my needs.I try to make it alone, and i put img.php usage.php and Webthumb.class.php on my ftp server.
I had an api and replace on the 2 files $wb->setApi(“…………”);
on img.php and usage.php . After i launch usage.php and nothing happends.
No message, no pictures. i make a mistake maybe ?
i took my api on the section of user of http://webthumb.bluga.net .
Thanks to tell me what i miss…And thanks for great programmer.
No matter how I try with this API wrapper or directly I am having no luck resetting the browser to 800×600 before the grab. I am using:
myapikey
http://google.com
800
600
But it always comes back as 1024×768 – can you help?
Try again… replace the curly brackets with triangle ones…
(webthumb)
(apikey)myapikey(/apikey)
(request)
(url)http://google.com(/url)
(width)800(/width)
(height)600(/height)
(/request)
(/webthumb)
Robin: You found a bug, its fixed now
Oh – I’m glad it’s not me – thanks!
Oh oh sorry but is it the right way to install the script on my ftp ? why nothing happens no creation of class ? Thanks to tell please.
Linkerman:
I didn’t write the PHP wrapper, so im not sure what its doing error handling wise.
But i know it uses the curl extension so if you don’t have that, you might be getting an error like that.
On the webthumb server side of things im just recieving http requests and sending reponses.
Thanks for your answer, i’ve got php Version 4.4.4 i saw the date of creation of function on this page http://php.benscom.com/manual/fr/ref.curl.php
I think the script php should work on my server, but i don’t know how.
i just wanted to send request with an url and get the url of thumbnails 80×60 back on my page.I just know little things about xml language i’m a novice.Can i use just javascript that could send you request with the info found here http://bluga.net/webthumb/api.txt ?
a script like this could be possible ? what can i add ?
And where enter the message xml from your information api.txt
function go()
{
var xhr_object = null;
if(window.XMLHttpRequest) // Firefox
xhr_object = new XMLHttpRequest();
else if(window.ActiveXObject) // Internet Explorer
xhr_object = new ActiveXObject(“Microsoft.XMLHTTP”);
else {
alert(“Navigator don’t support XMLHTTPRequest…”);
return;
}
xhr_object.open(“GET”, http://…, false);
xhr_object.send(null);
if(xhr_object.readyState == 4) alert(“Request Done !”);
}
Thanks a lot…
Linkerman, the script will only work with PHP5, sorry.
Alternative for non-php5 and curl-disabled hosts (most webservers on this planet) :
The HTTP class from Manuel Lemos can replace some of the methods used by CURL extension :
http://www.phpclasses.org/browse/package/3.html
The Ister simplexml44 car replace the php5-only SimpleXML extension (needs EXPAT) :
http://www.ister.org/code/simplexml44/index.xhtml
Some reality :
http://www.nexen.net/images/stories/phpversion/200605/evolution.milieu.en.mini.png
Hi,
thanks a lot for the tutorial. Since my web server doesn’t have libcurl I wrote the following class using the PEAR package HTTP_request:
private function _executeHttpRequest($request) {
$req =& new HTTP_Request($this->_request_uri);
$req->addHeader(‘Content-Type:’, ‘application/xml’);
$req->addRawPostData($request);
$response = $req->sendRequest();
if (PEAR::isError($response)) {
echo $response->getMessage();
} else {
//echo $req->getResponseBody();
return $req->getResponseBody();
}
}
It works quite finde, but I’m having another problem:
When the script asks the server for the current status after 5 seconds, the server returns the error “Cross dependency found in OUTER JOIN; examine your ON conditions” instead of an XML message such as …. I guess it’s got something to do with the database… But despite this error the requested screenshot is shown on the homepage of http://bluga.net/webthumb/.
Does anyone have any idea?
Thanks in advance,
NK
NK: thats a bug your hitting on the webthumb server. Can you send me the XML payload that causes that message (josh@bluga.net)
tobozo: XMLHttpRequest can only make requests to the same domain.