variable crop option with add_image_size()
-
In my child Theme I have set my custom image with add_image_size( ‘big’, 1500, 1000 ) I left out the crop parameter, but it is false by default anyway.
I want to make this a variable option.
I have just written a plugin that displays all the registered image sizes (including WP’s thumbnail, medium and large sizes) plus my custom size.
With checkboxes I do update_option($_size.”_crop”, true) for WP’s image sizes and global $_wp_additional_image_sizes; $_wp_additional_image_sizes[$_size][‘crop’] = true for my custom size.
The thumbnail, medium and large work all fine but I can’t get to override the default false $crop parameter from add_image_size? When I var_dump($_wp_additional_image_sizes;) on my plugin page after submitting changes the boolean displays true, but when I reload the plugin page without sumbit it is like add_image_size() wins over my plugin?
When I set add_image_size( ‘big’, 1500, 1000, true) in functions.php everything works like I want, but I want to make it an option to switch between hard and soft cropping – from my plugin options page obviously.
Here is my code:
http://codepad.org/wk700AfV
- The topic ‘variable crop option with add_image_size()’ is closed to new replies.