PDA

View Full Version : Grab image from other site



hannah sofia
06-10-2011, 03:03 PM
Hello,


<link rel="image_src" href="image.jpg" />

To show a thumb of your site to facebook, you need to have the above code between the head of your website.

How can I have that facebook feature--to show any image from other site to my site?

And if I type a url like below, it will show an image?


http://mysite.com/imagegrab.php?url=http://otherwebsite.com

It work if I want to grab the favicon:

http://www.google.com/s2/favicons?domain=google.com

But I want to grab any image from their site instead like facebook...

Thanks! hope you get what I mean and help me...

jscheuer1
06-10-2011, 04:31 PM
Yes, just copy the full (it's called absolute) address of the image you want and use that. It's called hotlinking.

However, many servers have policies against hotlinking and can block the request if it doesn't come from a page on the domain where the image is hosted. So this will not always work. In fact, if you already have the image cached on your computer, it may appear to work when it doesn't.

To test that, after you have it setup clear the browser's cache and see if you can still access the image from the hotlink.

Even if they're not blocking you, it might be illegal to hotlink - a form of copyright infringement. So do this sort of thing with respect for the other person's material.

As long as these are all your own images, you don't have to worry about the legal part, just whether or not hotlinking is allowed by the host.

hannah sofia
06-10-2011, 11:28 PM
Thanks for ur reply sir :)

My site is a text link dump. Users can promote their website content url.

I am thinking if instead of adding an image thumb each time a user will submit a link, maybe there's an automated way like facebook.

But anyway I found a solution by grabbing their favicon instead :)

http://getfavicon.appspot.com/

jscheuer1
06-11-2011, 01:40 AM
It all depends upon how the favicon is grabbed. What I mentioned about hotlinking may still apply.

But if that (the possibility that some of the favicon images might not show up) doesn't concern you, it seems like a nice touch.

traq
06-11-2011, 03:03 AM
if users are submitting their own links, then you could simply add the favicon-grabbing to your terms of service. you might also give users a way to manually submit their favicon if your grab attempt fails.

djr33
06-11-2011, 03:07 AM
Many sites don't have favicons. That might be a bigger problem for this. In that case, allowing users to submit a favicon or having a default (perhaps the first letter of the name of the site?) would be useful.