Web Hosting Talk







View Full Version : External Images through SSL


thanatas
03-29-2004, 01:01 PM
For the site I'm working on I need to put at the footer an image that ranks the current site. This image is not on the server, and it changes dynamicaly at random times (external call to the image). I need to get it working on my SSL pages, but I don't want the browser to ask the user if they "Want to Display InSecure items?". Anyone know a way around this (I need to keep the external link if possible cause it randomly changes).

radv
03-29-2004, 01:24 PM
To keep it secure you will need to call a secure page. The external link should also have an SSL cert.

Jon69
03-30-2004, 04:06 PM
I had this problem a little while ago and managed to get around it by writing a Perl script which ran on my SSL pages but pulled the image remotely.

I used the Image::Grab (http://search.cpan.org/~mahex/Image-Grab-1.4/lib/Image/Grab.pod) module to do this (it requires a couple of other modules to work - details are on the pod page).

The code for the script is a basic as it gets:

#!/usr/bin/perl

use Image::Grab;

$pic = new Image::Grab;
$image = "http://url.of.insecure/image.gif";

#Grab image
$pic->url($image);
$pic->grab;


#Print image
print "Content-type: image/gif\n\n";
print $pic->image;


exit;


Then just make the script accessible via your https and call it as the image link, e.g.


<img src="https://www.your-secure-site/image.cgi">


and Bob's your uncle. As far as the browser is concerned the image will be secure and you won't get any warning messages.

I'm not quite as versed in PHP but I would have thought it was possible to do something along the same lines if that's more your thing.

Oopsz
03-31-2004, 04:00 PM
You can just use apache's mod_rewrite. Throw this into a .htaccess.

RewriteEngine on
RewriteRule ^filename\.jpg$ http://www.remoteserver.net/directory/filename.jpg [P]