Attachments not displayed correctly after a server upgrade

Started by viaa, December 08, 2018, 09:49:19 PM

Previous topic - Next topic

viaa

I'm having issues with attachments in SMF 2.0 after my host made some changes to the platform. The PHP version was initially changed to 7.*, which obviously didn't work well with SMF. I was able to downgrade the PHP version back to 5.4.45 in Plesk and got everything working apart from the attachments.

The issue is that...

  • Attachments don't show up in the browser on the forum page or by accessing the attachment URL (index.php?action=dlattach;topic=X;attach=Y;image) directly
  • Attachment files can be downloaded locally, but when trying to view the file Windows, an error occurs ("Windows Photo Viewer can't open this picture because the file appears to be damaged, corrupted, or is too large.")
  • However, I'm able to view the downloaded file using XnView and the content shows up correctly

Obviously it's not a path configuration issue and the files themselves seem not to be corrupt. I'm guessing there's something about the way attacments are being processed in Display.php that doesn't go well with the current server configuration, but I haven't been able to locate the issue. I'm attaching the phpinfo file, if that is of any assistance.

Any ideas or help would be highly appreciated.

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Sir Osis of Liver

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

viaa

Unfortunately I've been stuck with 2.0.6 due to some non-standard customizations that have been made previously and no time to fix everything manually. I did experiment with the latest version of Display.php (I think 2.0.12) with no results. Sure, I do realise an uprade to the latest version would be advisable... That is probably the next thing to try if there's no simple solution.

shawnb61

It appears the attachments were corrupted somehow.  Could you attach one here?

Or provide a link to a page on your site?

Step 1, I think, is to confirm if the images are ok...
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

viaa

Quote from: shawnb61 on December 09, 2018, 11:31:28 AM
It appears the attachments were corrupted somehow.  Could you attach one here?

Sure, I have attached here one of the example .jpg's downloaded through the dlattach function. As I mentioned, the file can't be opened in the default Windows photo viewer, yet the content displays correctly when opened using e.g. XnView (hxxp:www.xnview.com/en/ [nonactive]). If I download the files over FTP and add the appropriate extention to the attachment name ("10038_32ad08819..."), I'm typically able to view the file normally in Windows. I actually did also find some files that seemed corrupt and didn't open even in XnView, but most of the files in my sample were OK. Well, honestly I don't know enough about image file formats to know what to look for in terms of if the file is OK or not  :-\

shawnb61

That image is corrupted.

I recall a very similar issue with a simple fix.  I'll do a bit of research, once my wife is done with the computer... 
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

viaa

Quote from: shawnb61 on December 09, 2018, 12:55:10 PM
That image is corrupted.

I recall a very similar issue with a simple fix.  I'll do a bit of research, once my wife is done with the computer...

Thanks a million!

shawnb61

This is the thread I was looking for:
https://www.simplemachines.org/community/index.php?topic=555558.0

In that issue, all images had extra line feeds in them due to a source code issue.   That does NOT appear to be the case here, looking at your sample image, so I don't think it helps here.

Quote from: viaa on December 09, 2018, 12:45:12 PM
If I download the files over FTP and add the appropriate extention to the attachment name ("10038_32ad08819..."), I'm typically able to view the file normally in Windows.

If this is universally true, then your images are good & we have some odd code or environment configuration issue.   If this is not universally true, then I suspect the files were corrupted.   

So the most important question in my mind here is:  Are the downloaded images different than the attachments ( the"10038_32ad08819...")?  Can you do a few & compare them?
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Sir Osis of Liver

There was a minor database change somewhere around 2.0.6 which caused a problem with attachment mime types.  IIRC, new attachments display correctly, old ones don't but are not corrupt.  I believe the fix was to run a db query to fix mime type field in attachments table.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Illori

how was the server upgraded? was it moved to a new server or the existing server was upgraded?

GigaWatt

Quote from: viaa on December 09, 2018, 12:45:12 PM
Sure, I have attached here one of the example .jpg's downloaded through the dlattach function. As I mentioned, the file can't be opened in the default Windows photo viewer, yet the content displays correctly when opened using e.g. XnView (https://www.xnview.com/en/). If I download the files over FTP and add the appropriate extention to the attachment name ("10038_32ad08819..."), I'm typically able to view the file normally in Windows. I actually did also find some files that seemed corrupt and didn't open even in XnView, but most of the files in my sample were OK.Well, honestly I don't know enough about image file formats to know what to look for in terms of if the file is OK or not  :-\

Do the exact same thing, but hex compare both images, see what is different in both images.

And for the record, the image displays correctly in FastStone Image Viewer as well, but, as you pointed out, not in Windows Photo Viewer... and also Windows fails to generate a thumbnail for it.
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Advertisement: