We help IT Professionals succeed at work.

PHP thumbnail generation and IE Save As

575 Views
Last Modified: 2010-07-27
Hello guys,

i have made an img.php that generates thumbnails for my images, and resize big images to 640x480.
i use

header('Content-Disposition: inline; filename=' . $fn); //$fn stands for file name

to save images with their original names while using Save As.

But when i add the images into another page using img tag or iframe it Save As doesnt work as expected. It tries to save as untitled.bmp

Here are 2 URLs one to a pop up page. and one to the image itself.
http://online.rek-man.com/pop.php?path=/REFLEX%20STOKLAR%20(AVRUPA)/50492_1_RGB.jpg&rt=stok
http://online.rek-man.com/inc/img.php?img=/REFLEX%20STOKLAR%20(AVRUPA)/50492_1_RGB.jpg&rt=stok

I have read a few articles to prevent IE saving images as untitled.bmp but they did not work.
what can be wrong?
 
Comment
Watch Question

Commented:
Using IE I get the same behavior you described, in an img tag it just calls itself image.bmp. FireFox does rename it well in both ways.

Did you add
header('Content-Type: image/jpg');
(or was it image/jpeg)
to your code? That should at least get rid of the bmp thing
Cem TürkSenior Software Engineer

Author

Commented:
Thanks for your reply.
its already  image/jpeg :)
i am just reading a jpg file from a directory and output it to browser via
 ImageJPEG function.
Top Expert 2007

Commented:
What about content-disposition: attachment?

--
Lee
Cem TürkSenior Software Engineer

Author

Commented:
i tried that before. when img.php is used as an iframe it tries to save the file with the correct name :) but it doesnt make any differance in image tag. I think its something with IE reading image source headers, because it works correct in most browsers except IE.
Top Expert 2007

Commented:
Oh no, I didn't read the original question right, sorry.  

'Save as' on an IMG element resulting in untitled.bmp is definitely not a server issue. Try clearing your temporary internet files first, then reset web settings.

http://support.microsoft.com/?kbid=260650 - Temporary Internet Files folder is full or you are using HTTPS and the images are not cached.  Possibly your images are not cached anyway using HTTP response directives like "pragma:no-cache" etc.

If the original file is not cached, all IE will have is a bitmap representation.  Other browsers ignore pragma:no-cache.

http://support.microsoft.com/?kbid=810978 - May also be the result of a damaged plug in.

--
Lee





Cem TürkSenior Software Engineer

Author

Commented:
i have already read that kb articles too. still no use :]
Top Expert 2007

Commented:
So, what http headers are being returned for that Image?  You'll need to use a tool like http://www.blunck.se/iehttpheaders/iehttpheaders.html to prove.

--
Lee
Senior Software Engineer
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.