[dx] Posted October 11, 2011 Share Posted October 11, 2011 Hi there, Is it possible to catch thumbnail of some website with php, or if not, which technics I need to use. In short, something like www.wimg.ca Regards Link to comment Share on other sites More sharing options...
justsomeguy Posted October 11, 2011 Share Posted October 11, 2011 They have that set up as a service, so apparently you can use that. Otherwise you need a rendering engine that can render the page and save it as a file. Link to comment Share on other sites More sharing options...
[dx] Posted October 11, 2011 Author Share Posted October 11, 2011 Do you have some clue? Is it hard? Link to comment Share on other sites More sharing options...
Ingolme Posted October 11, 2011 Share Posted October 11, 2011 It's really hard. It's kind of like programming your own browser except that you don't need to worry about parsing Javascript and reading cookies. Link to comment Share on other sites More sharing options...
[dx] Posted October 12, 2011 Author Share Posted October 12, 2011 Argh Thanks then.. Link to comment Share on other sites More sharing options...
[dx] Posted October 12, 2011 Author Share Posted October 12, 2011 Can I store this image on my server? I've tried with file_get_content etc. some fopen scripts but unsuccessfull. Link to comment Share on other sites More sharing options...
justsomeguy Posted October 12, 2011 Share Posted October 12, 2011 Yes, you can store the image on your server. Check their manual for more information about what they provide. http://www.wimg.ca/manual Link to comment Share on other sites More sharing options...
[dx] Posted October 13, 2011 Author Share Posted October 13, 2011 The problem is becouse it is not in format URL/filename.jpg, it's only URL. So there's source code <html> <body style="margin: 0px;"> <img style="-webkit-user-select: none" src="http://wimg.ca/http://w3schools.com"> </body></html> If we use file_get_contents(), it will use whole source (<html><body> too) becouse src is same as page. Link to comment Share on other sites More sharing options...
justsomeguy Posted October 13, 2011 Share Posted October 13, 2011 Why is it a problem that the URL doesn't have a filename? Link to comment Share on other sites More sharing options...
[dx] Posted October 13, 2011 Author Share Posted October 13, 2011 Don't know, I've tried same script for filename.jpg and URL, and first is saved, and second not. Just black screen. Link to comment Share on other sites More sharing options...
justsomeguy Posted October 13, 2011 Share Posted October 13, 2011 I guarantee the reason doesn't have anything to do with the URL including a filename, so that's not the solution. Link to comment Share on other sites More sharing options...
[dx] Posted October 13, 2011 Author Share Posted October 13, 2011 $image = file_get_contents("http://wimg.ca/http://www.w3schools.com");file_put_contents('image.jpg', $image); Fell free to test it. Link to comment Share on other sites More sharing options...
justsomeguy Posted October 13, 2011 Share Posted October 13, 2011 The website outputs a PNG, not a JPG. Link to comment Share on other sites More sharing options...
[dx] Posted October 13, 2011 Author Share Posted October 13, 2011 Nothing new.. Link to comment Share on other sites More sharing options...
justsomeguy Posted October 13, 2011 Share Posted October 13, 2011 It works fine for me. Link to comment Share on other sites More sharing options...
[dx] Posted October 13, 2011 Author Share Posted October 13, 2011 :/ I've tried jpg and png too, and other URL links and works fine, only this won't work.. Link to comment Share on other sites More sharing options...
[dx] Posted October 14, 2011 Author Share Posted October 14, 2011 Really strange, on other host it works.. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.