Advertisement:

Author Topic: Attachments not displayed correctly after a server upgrade  (Read 574 times)

Offline viaa

  • Newbie
  • *
  • Posts: 4
Attachments not displayed correctly after a server upgrade
« on: December 08, 2018, 09:49:19 PM »
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.

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 57,797
  • Gender: Male
    • Kindred-999 on GitHub
Re: Attachments not displayed correctly after a server upgrade
« Reply #1 on: December 08, 2018, 10:22:55 PM »
Smf 2.0.15 works perfectly well with php 7.0 or 7.1
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 8,611
Re: Attachments not displayed correctly after a server upgrade
« Reply #2 on: December 08, 2018, 11:17:28 PM »
Which 2.0 version are you running?

Offline viaa

  • Newbie
  • *
  • Posts: 4
Re: Attachments not displayed correctly after a server upgrade
« Reply #3 on: December 09, 2018, 07:42:33 AM »
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.

Offline shawnb61

  • Support Specialist
  • Sophist Member
  • *
  • Posts: 1,133
    • sbulen on GitHub
Re: Attachments not displayed correctly after a server upgrade
« Reply #4 on: December 09, 2018, 11:31:28 AM »
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

Offline viaa

  • Newbie
  • *
  • Posts: 4
Re: Attachments not displayed correctly after a server upgrade
« Reply #5 on: December 09, 2018, 12:45:12 PM »
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  :-\

Offline shawnb61

  • Support Specialist
  • Sophist Member
  • *
  • Posts: 1,133
    • sbulen on GitHub
Re: Attachments not displayed correctly after a server upgrade
« Reply #6 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... 
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Offline viaa

  • Newbie
  • *
  • Posts: 4
Re: Attachments not displayed correctly after a server upgrade
« Reply #7 on: December 09, 2018, 01:08:33 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!

Offline shawnb61

  • Support Specialist
  • Sophist Member
  • *
  • Posts: 1,133
    • sbulen on GitHub
Re: Attachments not displayed correctly after a server upgrade
« Reply #8 on: December 09, 2018, 02:51:40 PM »
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.

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

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 8,611
Re: Attachments not displayed correctly after a server upgrade
« Reply #9 on: December 09, 2018, 03:44:31 PM »
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.


Offline Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 50,402
Re: Attachments not displayed correctly after a server upgrade
« Reply #10 on: December 09, 2018, 03:53:13 PM »
how was the server upgraded? was it moved to a new server or the existing server was upgraded?

Offline GigaWatt

  • The Smiley Guy
  • Support Specialist
  • SMF Hero
  • *
  • Posts: 1,655
  • Gender: Male
    • Macedonian electronics forum
Re: Attachments not displayed correctly after a server upgrade
« Reply #11 on: December 13, 2018, 12:11:39 AM »
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?"..."