Delete unused images?
1) Could extremely large images (5+ mb) slow the site down, even if they're not in use on a page within the site? The site is running extremely slowly.
2) Is there a way to determine if an image is in use in a Concrete5 site?
As to your questions... I doubt they are slowing the site down and I know of no way to find out if an image is actively used in the site.
Large files will only slow the site down if they are actually used. Even then, re-sized files are kept, so c5 making a resized version of a large file will only happen once.
Otherwise large files just waste space, not time.
Surely there must be some method to determine if an image is in use -- whether in the C5 interface (ideal) or in the database?
I would imagine some database pointer is set when an image is added to a page. Is there a specific x-link table that tracks used images?
Someone else with more experience can 'school' me if I'm wrong.
Another possibility would be to upload re-sized pictures to replace the existing big pictures.
Yet another possibility would be to backup database and files, delete the big pictures from the filer manager, then quickly scan through pages looking for missing pictures. (Or revert if too many are missing)
EDIT - some info that may be useful for any code based solution: If the site is in c5.6+, the image helper leaves an _fXXX on the end of any image it has resized, where XXX is the fID. So providing the essential bit of info needed to back-trace a scaled image from the rendered page to the original file.
Thanks for your help, all great ideas.
I just spent an hour cleaning out images and trying to figure out if they were used and why there were duplicates. One example: I had multiple images that all had the exact same name. I believe the image had to be re-tweaked multiple times over a week or 2 and just kept getting uploaded without searching for the older one and deleting it. I am used to Windows not allowing same names in a folder, so at first it was confusing seeing the same name and image thumbnail as I scrolled. I was able to eliminate the copies by matching the image path in the site to the right image file. I then had to go through dozens of other images one at a time to see if they were even being used then deleted with my fingers crossed. My client has a local news block that will not be archived, so old news will be deleted. How are we going to organize/separate these images used on the news pages from the site's images in file manager? I can see now, after a year there will 100's of temporary images mixed in with the site's permanent ones.
Is this just remembering careful image management?
Do any of you guys have any tips on properly using the file manager so it works for us, not us working for it?
Highly capable and it lets me set a myriad of variables, destination folders, borders, watermarks. etc. Download it for free and check it out.
Scanning the site to find all images in use is a tedious thing and won't work perfectly in every situation. Think of some "tool" that gets called by an AJAX script - scanning that is rather tricky.
Instead I suggested that we need some kind of "file manager registration" - every add-on (block, attribute etc.) that uses files has to register itself as a "consumer".
With blocks, there's already something we could use. Check this:https://github.com/concrete5/concrete5/blob/master/web/concrete/core...
This is used when a block is exported into an XML file but could in theory also be used to see if a file is in use. We'd basically have to scan all blocks to see if $btExportFileColumns is defined - if it is, we'd have to scan the table and so on...
Right now you have no clue which add-on uses files and thus we need some kind of registration. When deleting a file we'd know where to check for any usages..