N
Neil Charlton
Hi
I would like to test for the existence of a .jpg image on a remote
server over HTTP.
I have tried 2 different methods but they are not what I need.
Method 1:
require 'open-uri'
if open('http://example.net/path/to/image.jpg')
# do something
end
Method 2:
require 'net/http'
if Net::HTTP.get 'example.net', '/path/to/image.jpg'
# do something
end
The server where the images are always returns a default page if the
images do not exist so the code above always returns.
What I need is a way to check what is returned is not a html page but is
a .jpg image.
Any help greatly appeciated.
Thanks
Neil
I would like to test for the existence of a .jpg image on a remote
server over HTTP.
I have tried 2 different methods but they are not what I need.
Method 1:
require 'open-uri'
if open('http://example.net/path/to/image.jpg')
# do something
end
Method 2:
require 'net/http'
if Net::HTTP.get 'example.net', '/path/to/image.jpg'
# do something
end
The server where the images are always returns a default page if the
images do not exist so the code above always returns.
What I need is a way to check what is returned is not a html page but is
a .jpg image.
Any help greatly appeciated.
Thanks
Neil