Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Image attachments not displayed on click, links force download of the image.

Started by Raugturi, June 21, 2009, 03:12:08 PM

Previous topic - Next topic



I've tried searching everywhere I can to find an explanation for this, but had no luck.  Whenever images are attached to a post on my forum (using SMF 2.0 RC1-1) using a lowercase file extenstion (.gif, .jpg, etc.) the link to "http://myforum/index.php?action=dlattach;topic=ID;id=ID;image" tries to download the image to the user's computer (in Firefox) or shows a blank page (in IE).  However, if you use an uppercase extension, it works as one would expect a link to an image to work and displays it in the browser.

Any ideas what would cause that or how to fix it?

Update: I'm not sure that this is the case now.  I found a few exceptions.  So now I don't understand what is going on at all.  Only that for some images it works and for some it does not.  Reading the Download() function in Display.php now to figure out why.

Another update: So unless I'm way off, it looks like the "Content-Disposition: attachment" is forcing it to treat any image attachment as a file to be downloaded, rather than in image to display.  Is there any way to change that?  I tried removing that from the header in the Download() function in Display.php but it made no difference.

Basically, I want to be able to modify Themes\default\Display.template.php to put a link on any attachments that are images, such that when a user clicks the link it brings up the image in their browser.

Last update: The images having trouble are missing the mime_type field in the database.  Since all but a few of them are from the same source (WoW Screenshots) I am guessing that the issue is on that end.

- Chris