PDA

View Full Version : For Allan and other image posters



Promethean
05-09-2006, 11:14 PM
I've written a quick hack to determine if the image you're linking will display or not. It's not a pretty script but quite effective.

http://www.motorcyclistcafe.com/tools/validate.php

Paste your image URL in the box and hit Submit Query. The next page should show you the image that you're linking. If you see a red x or a broken image placeholder....the site does not support remote linking. It's that simple.

This script was written in a few minutes so it's not foolproof.

BobFV1
05-10-2006, 07:07 AM
You the man!

fganger
05-10-2006, 08:05 AM
Abhijeet,

You never cease to amaze me. To quote a well-known R12GS rider - "You the man."

Frank

DarthRider
05-10-2006, 09:24 AM
Good one, Abhijeet!

Dave

Promethean
05-10-2006, 10:11 AM
I put my pants on just like the rest of you - one leg at a time. Except, once my pants are on, I make gold records.

popgazer
05-10-2006, 10:52 AM
Abhijeet,
Wow, that's fast
I did some testing.

Went to the Validate Page (http://www.motorcyclistcafe.com/tools/validate.php)

Cut and pasted one of Allan's links. I got the broken link. So far so good. Then I pasted the link directly in the broswer's url. I got to view the image, as expected. Now, the image is in the browser's cache. I go back to the validation page, click then bam, I get the image. loaded from cache.
So, for someone who is already viewing the image, it may look as though everything is dandy.

Maybe the script itself should test the link. For example, when I include a referer variable in a command line I get to find out exactly what's going on. Like this:


wget --referer="http://www,yahoo.com" "http://www.rudefun.com/pictures/various/69.jpg"
--08:19:25-- http://www.rudefun.com/pictures/various/69.jpg
=> `69.jpg'
Resolving www.rudefun.com... 67.15.52.61
Connecting to www.rudefun.com[67.15.52.61]:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
08:19:25 ERROR 403: Forbidden.

arkline
05-10-2006, 10:59 AM
Great hack, Fireguy. Could we have a tools section that keeps this one available for the long run???

Promethean
05-10-2006, 11:37 AM
Pop,
I thought about it this morning and was going to suggest that the user clear the cache before using the script. That is the limitation of the script at this time.

I could have just done the "PHP get" with a referer ID but that would have taken more time than I had to build and test. That's a great and elegant solution though.

Perhaps this weekend when I get some time I'll code it up. It's raining here this whole week anyway.


Abhijeet,
Wow, that's fast
I did some testing.

Went to the Validate Page (http://www.motorcyclistcafe.com/tools/validate.php)

Cut and pasted one of Allan's links. I got the broken link. So far so good. Then I pasted the link directly in the broswer's url. I got to view the image, as expected. Now, the image is in the browser's cache. I go back to the validation page, click then bam, I get the image. loaded from cache.
So, for someone who is already viewing the image, it may look as though everything is dandy.

Maybe the script itself should test the link. For example, when I include a referer variable in a command line I get to find out exactly what's going on. Like this:

Promethean
05-10-2006, 11:42 AM
Sure. We can just add a new FAQ in the FAQ manager amongst other things once the bugs in the script are ironed out.


Great hack, Fireguy. Could we have a tools section that keeps this one available for the long run???

popgazer
05-10-2006, 12:48 PM
Sure. We can just add a new FAQ in the FAQ manager amongst other things once the bugs in the script are ironed out.

Alternatively, the javascript script that inserts the image could be modified to perform the test and tell the the user right away if the inlining for that specific image is blocked.
:eusa_drool: Forgive me for suggesting this without offering to do it. I like what Javascript does but I never took the time to learn it properly.

Promethean
05-10-2006, 12:56 PM
That's a good point. Personally, I prefer to keep away from JS and don't know too much about using it effectively.

I barely know PHP....but it's a simple yet incredibly powerful language with an extensive API and it can do most things I demand of it quite well.

I'll have to weigh the effort of doing it in JS vs PHP and then decide. :)





Alternatively, the javascript script that inserts the image could be modified to perform the test and tell the the user right away if the inlining for that specific image is blocked.
:eusa_drool: Forgive me for suggesting this without offering to do it. I like what Javascript does but I never took the time to learn it properly.

supermotoC
05-10-2006, 04:34 PM
OK OK OK OK! That's enough acronyms for today. Good work, all, however.
FAQing good work, Abhijeet!

Promethean
05-10-2006, 11:25 PM
Oh....Collyer...if you're in IT.....you'll hear more than just these acronyms.

Update:
An additional step to use the script.....just refresh the output page a couple of times in your browser. That will cause the image to be fetched from the remote server rather than the cache. Very low-tech...I know but making this little tool bulletproof is more effort than its worth.



OK OK OK OK! That's enough acronyms for today. Good work, all, however.
FAQing good work, Abhijeet!

Promethean
05-12-2006, 11:46 PM
The script is fixed and works well. Enter a URL to see. If it's a valid link that allows remote linking..it will tell you that the server accepted the request and displays the image below.

If not, it will just tell you what the server response was.

Questions? Let me know.

http://www.motorcyclistcafe.com/tools/validate.php