News:

Join the Facebook Fan Page.

Main Menu

Attachments not showing

Started by barrie, October 01, 2012, 11:22:40 AM

Previous topic - Next topic

barrie

We recently converted our Forum from Webwiz to SMf and all has gone well except we cannot see any attachments in old posts that were migrated across. I have noticed that when you upload an image through SMF it encrypts the suffix and loses the .jpg, .gif etc and basicalyl renames them. Is there any way we can overcome this as we have uploaded 29000 images to the attachments folder and  none are showing because I presume they are .jpg or .gif suffixes ? Any help would be appreciated.

Looking

This may be of help to you: repair settings. upload it to your root of SMF and make sure all settings are correct.

barrie

Cheers, tried that and all paths and settings are correct.

Looking

What about for the theme you are using? Can you see attachments now in default theme?

Kays

Hi barrie, welcome to SMF. :)

SMF should be able to handle just the file name also. In what name format did Webwiz store the images on the server?

If you go into the database and look in the attachments table. For the older images, is there a value for for "file_hash"?

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

barrie

Changed the theme back to default and no change there ? It is to do with the attachments file names. I uploded all the images from our old forum to the attachments folder on SMF but they all have .jpg or .gif extensions and I believe that SMF changes these file extensions when you upload a new image so I cannot see how it will find the older uploaded images. If I create a new poll with an attachment it works fine ?

Take a look at this post with missing images : http://www.aircooledrdclub.com/smf/index.php?topic=34814.0

If yo look at the source code the URL to the image is correct and the image is in the attachments folder but it does not show ? In Admin I cannot see any of the uploaded old images in the Browse File section so I presume SMF cannot see them ?

barrie

Quote from: Kays on October 01, 2012, 12:04:26 PM
Hi barrie, welcome to SMF. :)

SMF should be able to handle just the file name also. In what name format did Webwiz store the images on the server?

If you go into the database and look in the attachments table. For the older images, is there a value for for "file_hash"?

Webwiz just stored them as .jpg or .gif etc and thats how they are in the attachments folder on my SMF install so I presume they cannot be read because SMF changes the file name when an image is uploaded ?

Kays


If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

barrie

Quote from: Kays on October 01, 2012, 12:08:36 PM
If you used an FTP client, is this relevant?

Important Notice: Do you use Filezilla?  Avatars and Attachments lost?


I used Filezilla and noticed the threads about uploading them as binary but surely this would only apply if I was trying to reload old SMF images from a back up which had the unusual long file names ? I tried uploading one of the image folders using Filezilla in Binary and it made no difference.

Kays

If the file name on the server matches the "filename" value in the attachments table in the database and there is no value for "file_hash". Then SMF should display the image.

So, do the file names match and is "file_hash" empty in the attachments table?

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

barrie

This is a screenshot of the attachments folder in MySQL. Does it make any sense to anyone ? I am not an expert.

And a screenshot of the file names and values. It only shows around 30 images here but we uploaded over 29000 !! And I can see them in the attachmenst folder via FTP but they are not in the database ?

Kays

Click on the "Browse" button on top and that'll take to a page with the actual data. Use the "Search" feature and do a search for the filename of one of the older files.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

barrie

Quote from: Kays on October 01, 2012, 12:34:37 PM
Click on the "Browse" button on top and that'll take to a page with the actual data. Use the "Search" feature and do a search for the filename of one of the older files.
Added a screenshot with the actual data to my last post. Thanks for yor attention to this. None of the old images are there yet I can see them via FTP in the attachments folder ?

Kays

Quote
And a screenshot of the file names and values. It only shows around 30 images here but we uploaded over 29000 !! And I can see them in the attachmenst folder via FTP but they are not in the database ?

There are multiple pages and judging by the format, those look like newer attachments.

Find a post with an attachment which is not working.

1/ Try to locate the file on the server using an ftp client by file name.
2/ Then, try to locate that file in the database. Do a search for the message id. "id_msg"

Do the file names match and is "file_hash" empty in the attachments table?

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

barrie

Okay, did exactly what you said and found the image on the server that is missing in the post then found it in the database and the file_hash is not empty it is like below and the image file names match ?

Image
25_Seat_sm.jpg    File_hash   = f6594ab2820f4bed8fbf2510b0b11c7f

I know there are more pages of images but not 29000 in the database which are showing in the attachments folder via FTP ?

Kays

And the name of the image on the server is the same as in the database?

Let me see if I can find a fix for this.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

barrie

Yes, the file names are the same. here is the source code to show you where it points to on the server :

<a href="http://www.aircooledrdclub.com/smf/index.php?action=dlattach;topic=34814.0;attach=31549"><img src="http://www.aircooledrdclub.com/smf/Themes/red/images/icons/clip.gif" align="middle" alt="*" />&nbsp;25_Seat_sm.jpg</a>
                              (118.62 kB - downloaded 14 times.)<br />
                              <a href="http://www.aircooledrdclub.com/smf/index.php?action=dlattach;topic=34814.0;attach=31550"><img src="http://www.aircooledrdclub.com/smf/Themes/red/images/icons/clip.gif" align="middle" alt="*" />&nbsp;25_Seat_sm.jpg</a>
                              (118.62 kB - downloaded 14 times.)<br />
                              <a href="http://www.aircooledrdclub.com/smf/index.php?action=dlattach;topic=34814.0;attach=31551"><img src="http://www.aircooledrdclub.com/smf/Themes/red/images/icons/clip.gif" align="middle" alt="*" />&nbsp;26_Seat_sm.jpg</a>
                              (74.74 kB - downloaded 14 times.)<br />
                              <a href="http://www.aircooledrdclub.com/smf/index.php?action=dlattach;topic=34814.0;attach=31552"><img src="http://www.aircooledrdclub.com/smf/Themes/red/images/icons/clip.gif" align="middle" alt="*" />&nbsp;27_Seat_sm.jpg</a>
                              (88.5 kB - downloaded 14 times.)<br />
                              <a href="http://www.aircooledrdclub.com/smf/index.php?action=dlattach;topic=34814.0;attach=31553"><img src="http://www.aircooledrdclub.com/smf/Themes/red/images/icons/clip.gif" align="middle" alt="*" />&nbsp;28_Seat_sm.jpg</a>
                              (90.21 kB - downloaded 14 times.)<br />
                              <a href="http://www.aircooledrdclub.com/smf/index.php?action=dlattach;topic=34814.0;attach=31554"><img src="http://www.aircooledrdclub.com/smf/Themes/red/images/icons/clip.gif" align="middle" alt="*" />&nbsp;29_Seat_trim_clips_sm.jpg</a>
                              (143.73 kB - downloaded 14 times.)<br />
                              <a href="http://www.aircooledrdclub.com/smf/index.php?action=dlattach;topic=34814.0;attach=31555"><img src="http://www.aircooledrdclub.com/smf/Themes/red/images/icons/clip.gif" align="middle" alt="*" />&nbsp;31_Seat_foam_sm.jpg</a>
                              (97.1 kB - downloaded 13 times.)<br />
                              <a href="http://www.aircooledrdclub.com/smf/index.php?action=dlattach;topic=34814.0;attach=31556"><img src="http://www.aircooledrdclub.com/smf/Themes/red/images/icons/clip.gif" align="middle" alt="*" />&nbsp;32_Seat_Base_sm.jpg</a>
                              (88.04 kB - downloaded 13 times.)<br />


Does that look right to you ?  The first image is the one I searched for and found it in the databse via MySQL and it has the same filename.

Kays

What's happening is because there's a value for file_hash, SMF is looking for an encrypted file name.

Something to try, In Subs.php in the Sources folder look for:


return $path . '/' . $attachment_id . '_' . $file_hash;


And replace that with:


if (!file_exists($path . '/' . $attachment_id . '_' . $file_hash))
return getLegacyAttachmentFilename($filename, $attachment_id, $dir, $new);
else
return $path . '/' . $attachment_id . '_' . $file_hash;


Do backup that file first though. :)

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

barrie

Tried that and nothing I am afraid. I noticed that there are only around 30 images showing in the Attachments when I am in the Admin section of the Forum - these are the ones that have a file_hash extension. So I presume that SMF just cannot see the 29000 or so that are in the Attachments folder on the server for some reason. I dont think there is any point trying to link these 30 images up to show. Its the 29000 that are there but SMF cannot see them that is the problem. If I make a new post and attach an image all works fine ? Check this post I just modified that had the URL link showing in the post but no image so I deleted the URL link and added the images :
http://www.aircooledrdclub.com/smf/index.php?topic=34814.0

Kays

It's a bit strange that only 30 are showing in the attachments listing. Even with an incorrect path or encyption, all of the older files should be listed there also.

For the older files, what information is in the database? Is the folder id there?

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Advertisement: