SocialMagick creates OpenGraph images. The generated image files are stored on your site, by default under media/com_socialmagick/generated. This happens for two reasons. First of all, generating images is time consuming. Having the generated images cached means that this time will only be spent once, speeding up your site. Second, when you are sharing a link to a site or application it will retrieve the URL of the OpenGraph image, not necessarily its contents right away. The image must remain available on your site for link previews to work. This behaviour depends on the third party site / application. For this reason, SocialMagick will by default never clean up old images.
The image filename is constructed as a hash of the page of your site you are displaying, the template ID and summary of its options, as well as the Text and the location of the Extra Image used to generate the image. When any of these factors change, so does the image filename. When you are actively working on your site, tuning the SocialMagick templates, changing the menu item OpenGraph options etc a lot of images will be generated.
Moreover, as we said, old images are never removed, even if the page has not been viewed for a very long time. This leaves behind the OpenGraph image.
Depending on the image format you use, these images can get quite big. PNG format images are the biggest, usually around 1-2 MiB each, whereas WebP images are the smallest, usually in the 100-200 KiB range.
If you are short on space you may want to remove old OpenGraph images. There are two ways to do that.
First, when you visit the SocialMagick Templates page in the backend you can see how much space your OpenGraph images take and delete all of them. They will be regenerated on demand.
Second, as long as you publish the Task - SocialMagick plugin you can use Joomla's Scheduled Tasks feature to create a scheduled task of the SocialMagick – Delete Obsolete Images type to automatically delete images older than a specific amount of time, ranging from 1 minute to 1 year. To set this up:
Make sure the Task - SocialMagick plugin is published. Go to → → and search for SocialMagick. Publish the entry whose type is Task.
Navigate to → → .
Click . In the task type list, find and select SocialMagick – Delete Obsolete Images.
Under Task Parameters, set Delete Images Older Than to the minimum age an image must have before it is eligible for deletion. The available options range from 1 minute to 1 year. The default is 1 week.
Configure the task schedule (how often the task runs) and any other standard Joomla scheduled task options, then save the task.
When the scheduled task runs it will delete all generated OpenGraph image files in media/com_socialmagick/generated whose file modification time is older than the configured threshold.
That said, we recommend AGAINST deleting old OpenGraph images on a production site. A production site will be indexed by search engine crawlers which access all of your site's pages sequentially. If these pages are set to generate OpenGraph images and these images are missing from your site, they will have to be generated. This takes up a lot of server resources. Therefore, crawling your site could have a MASSIVE impact in its performance if the OpenGraph images of old pages nobody but the crawler ever accesses!
If you are concerned about disk space and site performance, we recommend having OpenGraph image generation turned off by default, and only enable it for specific pages which you reasonably expect to be shared and would like to have custom OpenGraph images. For instance, a device manufacturer's site would likely want to enable OpenGraph images for the site's products and news sections, but not its community forum, and downloads / resources sections.