Link to home
Start Free TrialLog in
Avatar of OmniUnlimited
OmniUnlimitedFlag for United States of America

asked on

AAAARG! - Another issue with IE!

Hello Experts:

I am having problems with displaying images on my site using IE.  The site is password protected through .htaccess and pulls its images from another password protected site.

I am trying to use the format "http://username:password@12.34.56.78/images/test.jpg" for the image source which works just fine in Chrome, Firefox and Safari, but will not show the image in IE.

What can be done so that my images will be seen in IE?
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Tools >> internet options >> advanced tab >> scrolldown to multimedia and make sure all boxes are checked.

If that does not work it is probably some ActiveX security nonsense. IE has never like remote images very much.

Cd&
Avatar of OmniUnlimited

ASKER

Thanks COBOLdinosaur, but the Internet Options thing did not work.

I am really looking more for any possible coding solutions, because I want these images to be visible in any browser or on any computer I choose.
I want these images to be visible in any browser or on any computer I choose.

Well, good luck with that.  You do not have control over the user settings, and the user will decide how they view your pages, images, and anything else on the page.  The format you are using would never show up on any of my browsers, because the url uses a pattern I use in my adblocker to block ads.  And certainly some security addons would block it unless the ip was whitelisted.

You can serve up anything you want but the user will decide what to accept.  An additional problem is that many users never change the browser defaults so you need to test every browser on every device. If you are going to use a non-standard format that may not cut it with the default of some browser on some computer.  This particular format that IE does not like might be because it is cross-domain and some kind of anti-phishing setting is blocking it.


Cd&
OK, but this sort of problem is not so common when a standard URL is used, am I not correct?

Isn't there a way I could change the url for the images so that I no longer need to include the username:password combination in the image source?
If the site hosting the image does not need the username and password you can probably bring it in without much of a problem for most users, but if a browser is really locked down and won't permit third party content they still won't get it.  The best solution would be to host the image on the same domain as the page.

However if the site hosting the image requires the username and password, you could use a server side job to send the request and cache it, and then deliver to the browser from your own domain.


Cd&
OK, so you are saying that the only solution using server side scripting would be to obtain the image and cache it, then deliver it to the browser?  There's no way to eliminate the caching part?
You could do it without caching as long as the response time from the other server is not going to tank the overall response time. it add a little extra overhead, but it should not be very much.

Cd&
OK, but now I need an example.  My site uses PHP.  How would you propose I do this, with fopen, file, file_get_contents, curl?  What would the code look like?
I think file_get_contents will work fine

<?php
echo file_get_contents("http://username:password@12.34.56.78/images/test.jpg");
?>


Cd&
How do I work this into the image source?
<img src=<?php echo file_get_contents("http://username:password@12.34.56.78/images/test.jpg");?> />


Should do it I think.  If not we will have to save it to a file and echo the file name in the src

Cd&
Sorry it took so long to get back to you.  Using

<img src=<?php echo file_get_contents("http://username:password@12.34.56.78/images/test.jpg");?> />

just gives me a bunch of gobblty-gook instead of an image.  Additionally, the file_get_contents is just dumping the image as text into the src attribute (similar to a Data URI scheme.)

There are many reasons why not to use a Data URI scheme when posting images, among them is the fact that a page full of these will tank how fast my page loads.

I also don't like what you proposed as far as saving it to a file and echoing the file name in the src, as that would add thousands of images to my already taxed hard drive and creating duplicates of the images I have on the other server.

Can you give me a coding example of what you proposed in 39477688?
ASKER CERTIFIED SOLUTION
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Not exactly what I was looking for (hence the "B" instead of an "A"), but it did work.  Thanks for the assistance.