lucid-fox / social-magick

An Open Graph Image generator plugin for Joomla 3 and 4
GNU General Public License v3.0
15 stars 1 forks source link

Add visual template selection #5

Closed crystalenka closed 3 years ago

crystalenka commented 3 years ago

In menu items/wherever template selection happens, it would be better to select the template based on what it looks like-not the name.

We would need to generate a sample image for every template upon saving. Unlike the actual og images, these SHOULD be overridden instead of making a new image every time.

We can use the template name plus "your text here" as sample text, and a generic sample placeholder image if the template uses a overlay or underlay image.

nikosdion commented 3 years ago

The problem is how do you generate the preview images.

For starters, we are a plugin. Our code doesn't run on saving the configuration unless the plugin is already enabled. Therefore, if you save the configuration while the plugin is unpublished there are no preview images generated.

If we were running code when saving we could check the previous configuration, see which templates were added / modified and regenerate their images only. Since this is not the case we can't know when something has changed, e.g. if it's changed while the plugin was disabled and we have no or a stale image. As a result, we'd have to regenerate preview images for all templates every time you save the plugin parameters when the plugin is enabled. With more than 3-4 templates you run the risk of timing out or at the very least annoy the user severely because saving the plugin would take tens of seconds.

Since this feature cannot work smoothly we decided not to implement it at all after all.