MG 2.0 Thumbnail not showing

ibaker

Well-known member
I recently upgraded to XF v2 and looking in my media section I am seeing some images that seem to be missing thumbnails:

here is an example of 1 page:
1.webp

Here is what happens when you click on one of them to see the image
2.webp
 
I've found that image - it's pretty huge.

It's 6000 x 4000 pixels which exceeds the default limit for resizing images. It's actually highly likely that it didn't have a thumbnail in XFMG v1 either, unless one was uploaded manually, as the same limit would have been hit in XF1 too.

If you add this to src/config.php:
PHP:
$config['maxImageResizePixelCount'] = 30000000;
Then it will no longer be prevented from resizing images greater than 20 megapixels (which is the default).

After that, you can either go into each media item, click the menu (next to the Watch button) and click "Change thumbnail" and hit "Save". That will trigger a thumbnail rebuild for that image.

Alternatively, you can trigger a thumbnail rebuild under rebuild caches, but that will apply to all images and take some time to run.
 
Although we do rebuild thumbnails and change their location during the upgrade, we don't touch the original images themselves during the upgrade. So there's nothing in the process of upgrading that would have lost those images. Though of course the thumbnail rebuild will have discarded the original thumbnail, and now failed to create the new thumbnail, thus now highlighting that the original image no longer exists.

So it's probable that the image has been missing for a while, but it's now noticeable because those thumbnails have gone.

As for how the image went missing, I'm not sure. Whenever we've seen this before, it's been related to either a backup and restore process which has skipped the files, or server moves from one server to another.

If you have any backups it would be good to identify when they went missing, but also that would enable you to locate and restore the files too, if you can locate them.
 
Thanks Chris, I have monthly backups going back to late 2015 so I will see when the images were first uploaded and restore those backups on my PC and try and dig in to get the image...thanks again
 
Might be quite tricky to locate actually because we store the media items as attachments, so the media ID won't match up with what's on the file system.

So you'd need a query like this to figure out what to look for in the files:
SQL:
SELECT CONCAT('internal_data/attachments/', FLOOR(ad.data_id / 1000), '/', ad.data_id, '-', ad.file_hash, '.data')
FROM xf_mg_media_item AS m
LEFT JOIN xf_attachment AS a ON
    (a.content_id = m.media_id AND a.content_type = 'xfmg_media')
LEFT JOIN xf_attachment_data AS ad ON
    (a.data_id = ad.data_id)
WHERE m.media_id IN(999, 9999)
(Where IN(999, 9999) is a comma separated list of media IDs that have gone missing).

That should return the file paths. If it doesn't, then it would suggest the actual attachment records have gone missing, which would be odd.
 
Thanks Chris but I am noticing that most of the lost images are dated around 2013 which seems to have come from the transition from a XF addon import into your initial Media Gallery...I think it was about that time
 
Top Bottom