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?
LVL 17
OmniUnlimitedAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

COBOLdinosaurCommented:
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&
0
OmniUnlimitedAuthor Commented:
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.
0
COBOLdinosaurCommented:
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&
0
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

OmniUnlimitedAuthor Commented:
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?
0
COBOLdinosaurCommented:
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&
0
OmniUnlimitedAuthor Commented:
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?
0
COBOLdinosaurCommented:
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&
0
OmniUnlimitedAuthor Commented:
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?
0
COBOLdinosaurCommented:
I think file_get_contents will work fine

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


Cd&
0
OmniUnlimitedAuthor Commented:
How do I work this into the image source?
0
COBOLdinosaurCommented:
<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&
0
OmniUnlimitedAuthor Commented:
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?
0
COBOLdinosaurCommented:
The three ways of doing the save of an image from remote is explored in this article.

http://www.phpmind.com/blog/2012/10/how-to-save-remote-image-in-server-or-save-image-from-a-url/

Caution: allow_url_fopen is used to enable this, and that can be a security issue.  

You can use any of the methods to save to a file.  If the image is dynamic you can use a CRON job to cache in background, and delete any extras you no longer need.

Cd&
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
OmniUnlimitedAuthor Commented:
Not exactly what I was looking for (hence the "B" instead of an "A"), but it did work.  Thanks for the assistance.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Browsers

From novice to tech pro — start learning today.