Search

I’m building an extension to crop images. The JavaScript part ist halfway done and now I want to add flexible configuration options for admins. The idea ist to define different sets of options (like aspect ratio, max/min dimensions,… ) for the different use cases of the extension and to choose when which set is applied.

I didn’t create a new field for the extension where the options could be saved because I want to apply the extension to existing fields (upload an textarea at the moment). One key point is to be able to set more than one option set for one appearence of tthe extension. Imagine e.g. differently cropped big, medium and thumbnail images for one upload field.

At first i tried doe save the sets as arrays in a general imagecropper-array in config.php. But i seems that you can only save strings as values (or am I wrong?). No I think that I could create a hidden section to save the options and to use config.php to only save the associations between fields with image cropper funcionality an entry with options. Or I could save the options somewhere different, e.g. own database table or separate configuration file in the extension folder.

Any ideas or hints?

But i seems that you can only save strings as values (or am I wrong?)

Yeah, the config class doesn’t handle arrays. Maybe it should? One way is to serialize() it before sending it to the config and unserialize() on the way out.

I would probably suggest the Extension maintain its own table in the database though. Going to give you the most amount of flexibility without things getting too complex.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details