Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: viaa on December 08, 2018, 09:49:19 PM

Title: Attachments not displayed correctly after a server upgrade
Post by: viaa 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...

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.
Title: Re: Attachments not displayed correctly after a server upgrade
Post by: Kindred on December 08, 2018, 10:22:55 PM
Smf 2.0.15 works perfectly well with php 7.0 or 7.1
Title: Re: Attachments not displayed correctly after a server upgrade
Post by: Sir Osis of Liver on December 08, 2018, 11:17:28 PM
Which 2.0 version are you running?
Title: Re: Attachments not displayed correctly after a server upgrade
Post by: viaa 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.
Title: Re: Attachments not displayed correctly after a server upgrade
Post by: shawnb61 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...
Title: Re: Attachments not displayed correctly after a server upgrade
Post by: viaa on December 09, 2018, 12:45:12 PM
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 (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  :-\
Title: Re: Attachments not displayed correctly after a server upgrade
Post by: 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... 
Title: Re: Attachments not displayed correctly after a server upgrade
Post by: viaa on December 09, 2018, 01:08:33 PM
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!
Title: Re: Attachments not displayed correctly after a server upgrade
Post by: shawnb61 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.

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?
Title: Re: Attachments not displayed correctly after a server upgrade
Post by: Sir Osis of Liver 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.

Title: Re: Attachments not displayed correctly after a server upgrade
Post by: Illori 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?
Title: Re: Attachments not displayed correctly after a server upgrade
Post by: GigaWatt on December 13, 2018, 12:11:39 AM
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.