As designed xfmg_thumbnail template function doesn't use $entity->hasThumbnail

Jake B.

Well-known member
Affected version
2.0.2
Basically, I'm trying to temporarily show the full image in place of the thumbnail while thumbnails rebuild as this site has well over 1m media items, so the thumbnail rebuild process is taking quite some time to complete. I ended up having to directly edit the xfmg_thumbnail function to make it use $entity->hasThumbnail() instead of directly checking $entity->thumbnail_date even though that hasThumbnail function exists and is extendable
 
Was this just for the purposes of extending the code? This actually deliberately doesn't use the hasThumbnail function because there are a few different combinations which mean we check the thumbnail_date and custom_thumbnail_date values separately.

TBH the way I'd have approached it is to edit or use a TM to check has_thumbnail in the template and if it does, call the default function and if it doesn't then call some other getter or similar to return the full image.

I'm reluctant to make any changes here just because this seems like a bit of a special case and there are other approaches that can be taken.
 
This was only for a temporary solution I had in place that would show the full size image instead of the thumbnail while the thumbnails were rebuilding, it was just loading the default thumbnail regardless of the output of hasThumbnail within the xfmg_thumbnail template function without attempting to run getThumbnailUrl, ended up just temporarily modifying this while the thumbnail rebuild was running so they didn't have 1M+ default thumbnails showing up after the migration completed
 
Top Bottom