Browse Source

added missing module fixer and updated imagecache_actions

Bachir Soussi Chiadmi 1 year ago
parent
commit
0bcc558ed5
83 changed files with 6326 additions and 2457 deletions
  1. 0 1
      sites/all/modules/imagecache_actions/.gitignore
  2. 138 4
      sites/all/modules/imagecache_actions/CHANGELOG.txt
  3. 49 20
      sites/all/modules/imagecache_actions/README.txt
  4. 112 90
      sites/all/modules/imagecache_actions/ROADMAP.txt
  5. 4 7
      sites/all/modules/imagecache_actions/autorotate/imagecache_autorotate.info
  6. 19 7
      sites/all/modules/imagecache_actions/autorotate/imagecache_autorotate.install
  7. 177 78
      sites/all/modules/imagecache_actions/autorotate/imagecache_autorotate.module
  8. BIN
      sites/all/modules/imagecache_actions/autorotate/portrait-painting.jpg
  9. 1054 213
      sites/all/modules/imagecache_actions/canvasactions/canvasactions.inc
  10. 4 21
      sites/all/modules/imagecache_actions/canvasactions/imagecache_canvasactions.info
  11. 0 27
      sites/all/modules/imagecache_actions/canvasactions/imagecache_canvasactions.install
  12. 74 25
      sites/all/modules/imagecache_actions/canvasactions/imagecache_canvasactions.module
  13. 9 5
      sites/all/modules/imagecache_actions/canvasactions/rounded_corners.inc
  14. 20 19
      sites/all/modules/imagecache_actions/canvasactions/tests/cheap_dropshadow.imagecache_preset.inc
  15. 0 1
      sites/all/modules/imagecache_actions/canvasactions/tests/keyword_positioning.imagecache_preset.inc
  16. 3 3
      sites/all/modules/imagecache_actions/canvasactions/tests/positioned_underlay.imagecache_preset.inc
  17. 4 4
      sites/all/modules/imagecache_actions/canvasactions/tests/rotate_alpha.imagecache_preset.inc
  18. 4 4
      sites/all/modules/imagecache_actions/canvasactions/tests/rotate_alpha_gif.imagecache_preset.inc
  19. 0 1
      sites/all/modules/imagecache_actions/canvasactions/tests/rotate_scale.imagecache_preset.inc
  20. 5 4
      sites/all/modules/imagecache_actions/canvasactions/tests/rotate_scale_alpha.imagecache_preset.inc
  21. 3 3
      sites/all/modules/imagecache_actions/canvasactions/tests/rounded.imagecache_preset.inc
  22. 3 3
      sites/all/modules/imagecache_actions/canvasactions/tests/rounded_bl.imagecache_preset.inc
  23. 0 1
      sites/all/modules/imagecache_actions/canvasactions/tests/rounded_flattened.imagecache_preset.inc
  24. 0 1
      sites/all/modules/imagecache_actions/canvasactions/tests/watermark_100.imagecache_preset.inc
  25. 0 1
      sites/all/modules/imagecache_actions/canvasactions/tests/watermark_50.imagecache_preset.inc
  26. 66 0
      sites/all/modules/imagecache_actions/coloractions/imagecache_coloractions.htaccess_creator.inc
  27. 4 5
      sites/all/modules/imagecache_actions/coloractions/imagecache_coloractions.info
  28. 8 23
      sites/all/modules/imagecache_actions/coloractions/imagecache_coloractions.install
  29. 948 117
      sites/all/modules/imagecache_actions/coloractions/imagecache_coloractions.module
  30. 88 79
      sites/all/modules/imagecache_actions/coloractions/transparency.inc
  31. 55 5
      sites/all/modules/imagecache_actions/customactions/README.txt
  32. 4 7
      sites/all/modules/imagecache_actions/customactions/imagecache_customactions.info
  33. 2 2
      sites/all/modules/imagecache_actions/customactions/imagecache_customactions.install
  34. 135 109
      sites/all/modules/imagecache_actions/customactions/imagecache_customactions.module
  35. 36 0
      sites/all/modules/imagecache_actions/image_effects_text/Apostrophic Labs License Komika).txt
  36. BIN
      sites/all/modules/imagecache_actions/image_effects_text/Blokletters-Balpen.ttf
  37. BIN
      sites/all/modules/imagecache_actions/image_effects_text/Blokletters-Potlood.ttf
  38. BIN
      sites/all/modules/imagecache_actions/image_effects_text/Blokletters-Viltstift.ttf
  39. 24 0
      sites/all/modules/imagecache_actions/image_effects_text/Creative Commons Attribution Share 2.5 (Blokletters).txt
  40. BIN
      sites/all/modules/imagecache_actions/image_effects_text/Komika_display.ttf
  41. 93 0
      sites/all/modules/imagecache_actions/image_effects_text/OFL (Pacifico).txt
  42. BIN
      sites/all/modules/imagecache_actions/image_effects_text/Pacifico.ttf
  43. 76 31
      sites/all/modules/imagecache_actions/image_effects_text/README.txt
  44. 366 174
      sites/all/modules/imagecache_actions/image_effects_text/image_effects_text.inc
  45. 5 5
      sites/all/modules/imagecache_actions/image_effects_text/image_effects_text.info
  46. 0 25
      sites/all/modules/imagecache_actions/image_effects_text/image_effects_text.install
  47. 34 3
      sites/all/modules/imagecache_actions/image_effects_text/image_effects_text.module
  48. 6 5
      sites/all/modules/imagecache_actions/image_effects_text/image_effects_text_test/README.txt
  49. 0 483
      sites/all/modules/imagecache_actions/image_effects_text/image_effects_text_test/image_effects_text_test.features.inc
  50. 7 10
      sites/all/modules/imagecache_actions/image_effects_text/image_effects_text_test/image_effects_text_test.info
  51. 603 1
      sites/all/modules/imagecache_actions/image_effects_text/image_effects_text_test/image_effects_text_test.module
  52. BIN
      sites/all/modules/imagecache_actions/image_effects_text/image_effects_text_test/lhandw.ttf
  53. 185 162
      sites/all/modules/imagecache_actions/image_overlay.inc
  54. 4 4
      sites/all/modules/imagecache_actions/image_styles_admin/README.txt
  55. 52 0
      sites/all/modules/imagecache_actions/image_styles_admin/image_styles_admin.css
  56. 114 31
      sites/all/modules/imagecache_actions/image_styles_admin/image_styles_admin.inc
  57. 4 4
      sites/all/modules/imagecache_actions/image_styles_admin/image_styles_admin.info
  58. 19 0
      sites/all/modules/imagecache_actions/image_styles_admin/image_styles_admin.js
  59. 104 18
      sites/all/modules/imagecache_actions/image_styles_admin/image_styles_admin.module
  60. 0 9
      sites/all/modules/imagecache_actions/imagecache_Actions.install
  61. 4 7
      sites/all/modules/imagecache_actions/imagecache_actions.info
  62. 16 0
      sites/all/modules/imagecache_actions/imagecache_actions.install
  63. 2 30
      sites/all/modules/imagecache_actions/imagecache_actions.jquery.js
  64. 0 4
      sites/all/modules/imagecache_actions/imagecache_actions.module
  65. 103 71
      sites/all/modules/imagecache_actions/imagefilter.inc
  66. 0 1
      sites/all/modules/imagecache_actions/tests/corners_combo.imagecache_preset.inc
  67. 0 1
      sites/all/modules/imagecache_actions/tests/default.imagecache_preset.inc
  68. 5 4
      sites/all/modules/imagecache_actions/tests/imagecache_testsuite.info
  69. 259 166
      sites/all/modules/imagecache_actions/tests/imagecache_testsuite.module
  70. 0 1
      sites/all/modules/imagecache_actions/tests/relative_canvas.imagecache_preset.inc
  71. 1 2
      sites/all/modules/imagecache_actions/tests/scale.imagecache_preset.inc
  72. 1 2
      sites/all/modules/imagecache_actions/tests/scale_canvas.imagecache_preset.inc
  73. 0 1
      sites/all/modules/imagecache_actions/tests/scale_rotate.imagecache_preset.inc
  74. 69 65
      sites/all/modules/imagecache_actions/utility-color.inc
  75. 22 16
      sites/all/modules/imagecache_actions/utility-form.inc
  76. 243 145
      sites/all/modules/imagecache_actions/utility.inc
  77. 119 86
      sites/all/modules/imagecache_actions/watermark.inc
  78. 339 0
      sites/all/modules/module_missing_message_fixer/LICENSE.txt
  79. 53 0
      sites/all/modules/module_missing_message_fixer/README.txt
  80. 64 0
      sites/all/modules/module_missing_message_fixer/includes/module_missing_message_fixer.admin.inc
  81. 130 0
      sites/all/modules/module_missing_message_fixer/includes/module_missing_message_fixer.drush.inc
  82. 13 0
      sites/all/modules/module_missing_message_fixer/module_missing_message_fixer.info
  83. 159 0
      sites/all/modules/module_missing_message_fixer/module_missing_message_fixer.module

+ 0 - 1
sites/all/modules/imagecache_actions/.gitignore

@@ -1 +0,0 @@
-*.patch

+ 138 - 4
sites/all/modules/imagecache_actions/CHANGELOG.txt

@@ -3,6 +3,140 @@ Imagecache Actions
 
 Imagecache Actions 7.x-1.x-dev
 ------------------------------
+
+Imagecache Actions 7.x-1.9
+--------------------------
+- [#2760121] by lebster, fietserwin: Add a "Perspective" effect.
+- [#2947014]: PHP 7.2 warning that each() has been deprecated.
+
+Imagecache Actions 7.x-1.8
+--------------------------
+- [#2917097]: PHP 7.1 Warning "A non-numeric value encountered".
+- [#2905130] by bserem, fietserwin: Remove animation from moving images.
+- [#2888678] by das-peter: ImageMagick: Add support for invert effect.
+- [#1099300]: Notice: A non well formed numeric value encountered in
+  image_gd_definecanvas() (line 381 of canvasactions.inc).
+- [#2719661] by SKAUGHT: Division by zero.
+- [#2717789]: Prevent exif_read_data() warnings.
+- Warning: Theme hook coloractions_invert_summary not found.
+- [#2696225] by mnlund, fietserwin: Add support for multiply color blending.
+- by fietserwin: image_styles_admin: sort image styles by label.
+- [#2039379]: Add some better examples for using custom actions.
+- Made more contextual information (image style and image effect) available in
+  the custom action and text image effects.
+- [#2690337] by Ajithlal, fietserwin: Would like a feature for converting case
+  in text effect.
+
+Imagecache Actions 7.x-1.7
+--------------------------
+- [#2671526]: Fatal error on image style flush when image styles are defined in
+  Features.
+
+Imagecache Actions 7.x-1.6
+--------------------------
+- [#2664020]: IE fails to display images whose extension and Content-Type header
+  do not match the actual image type.
+- [#1591484]: Underlay not working (on IM).
+- [#2359523]: Follow up to improve help text.
+- [#2615986] by hargobind: Effect summary in image_styles_admin.module.
+- Notice: Undefined index: element in theme_coloractions_alpha_summary() (line
+  98 of coloractions\transparency.inc).
+- Removed superfluous theme entry 'imagecache_subroutine_summary' from
+  autorotate sub module.
+- [#2080877] by heathdutton: Interlace / Progressive effect.
+- [#760438] by fietserwin: Resize Overlay / Watermark for ImageMagick.
+- [#760438] by raintonr, Ace Cooper, ttkaminski, thijsvdanker, fietserwin:
+  Resize Overlay / Watermark (GD only).
+- [#768980] by idebr, fietserwin: Blur effect.
+- [#2636314]: 'Import style' can fail on newline characters.
+- [#2573225]: Resize by percentage not calculating other field.
+- [#2447419]: Correct erroneous call to module_load_include in
+  imagecache_canvasactions.module.
+- [#2416805]: Remove reference to non-existent imagecache_coloractions.install.
+- [#2416805]: remove deprecated jquery attr() and replace with FAPI #states
+  (rounded corners UI form).
+- [#2580805]: Coding standards corrections.
+
+
+Imagecache Actions 7.x-1.5 2014-11-29
+-------------------------------------
+- [#2366163]: autorotate sometimes doesn't work with ImageMagick.
+- Text effect: small clean-up of hook_exit().
+- [#2379359]: image_imagemagick_overlay() passes a stream wrapper to convert.
+- [#2359523]: Overlay: allow to define offsets from all sides.
+- [#1717436]: Add effects: color level adjustment and desaturate while retaining
+    alpha.
+- [#2278233]: Call to undefined function imagecache_actions_get_style_label().
+- [#2183721]: Duplicate/Export links just edit, they don't duplicate or export.
+    possible solution only.
+- [#2176727]: New actions: scale / resize by percent.
+- [#2190759]: hook_image_style_flush(): Prefer silent failure over clear failure.
+- [#2166715]: Typo causes extra query every page load.
+- [#2139091]: # sign before HEX in settings form breaks Define canvas action.
+- [#2085967]: Remove .gitignore from version control.
+- Text overlay: treat empty texts as normal situation.
+- [#2003446]: Clean up or remove .install files, adapt .info files.
+- [1854270-48]: Minor optimization for Posterize.
+- Refactor: eliminate test warnings and errors.
+- Refactor: standardize function and parameter naming, function order, doxygen
+    documentation and comments, remove spelling errors in doc and comments.
+
+
+Imagecache Actions 7.x-1.4 2013-08-24
+-------------------------------------
+- [#1778214]: Remove project from image_effects_text_test.info
+- [#1854270]: Posterize action for file size/bandwidth saving on PNGs.
+- [#2060173]: Support image labels (introduced by D7.23).
+- Cleaned up the output of image style export. Id's and help texts are not used
+  on import, so don't have to be exported.
+- Repaired farbtastic colorpicker. It seems the library invocation changed
+  sometime in history. Rebuilt the color picker form to use #attached libraries
+  and simpler inline script instead. REMOVED the theme function that is now
+  redundant as #attached is a better way than drupal_add_js.
+- [#1152736]: Support tokens in text actions for images.
+- [#2025631]: Imagecache Testsuite refers to non-existent permissions.
+- Drupal.org went from http to https: changed all links in our documentation and
+  code.
+- Added ImageEffects as other image effect providing module.
+
+
+Imagecache Actions 7.x-1.3 2013-06-04
+-------------------------------------
+- Removed some errors and warnings from the test suite code (but not all).
+- [#2010560]: Fix spelling for "Update 7001".
+
+
+Imagecache Actions 7.x-1.2 2013-06-01
+-------------------------------------
+- [#1830130]: Allow file fields as referring entities in effects with context.
+- [#1446160]: Integrate with media module: Title and Alt text.
+- [#1591198]: Have dimensions calculations not ignore NULL's.
+- Refactored canvas effects: added parameter types in documentation and
+  signatures. Standardized function documentation. Comments according to Drupal
+  coding standards.
+- [#1999140]: Canvas effects using imagemagick might fail due to earlier
+  -gravity settings.
+- Refactored the image_effects_text_test module to no longer depend on features.
+- [#1998354]: Non-ASCII characters fail to display correctly on many systems
+  (when using Imagemagick).
+- Further code enhancements (messages, comments) to autorotate.
+- [#1930728]: Autorotate does not reset EXIF orientation tag.
+- [#1990620] Many config form docs missing from the D7 upgrade. Converted all
+  legacy instances of #type=markup into #markup='content..'
+- Removed deprecated functions imagecache_actions_entities_from_references() and
+  imagecache_actions_fields_from_filepath() (see [#1844298]).
+- [#1983168]: Custom text via PHP causing EntityMalformedException ...
+- Replaced lhandw.ttf font with some real free fonts that may also be
+  distributed for free. Changed all text effect tests accordingly.
+- Better text effect defaults (translated sample text, text visible by default,
+  sample font file).
+- [#1986304]: Strict warning: Only variables should be passed by reference ...
+- [#1981490]: Wrong filename imagecache_Actions.install.
+- [#1858760]: Unable to find the file 'lhandw.ttf'. Please check the path.
+
+
+Imagecache Actions 7.x-1.1 2012-12-04
+-------------------------------------
 - [#1591198]: Image dimensions callbacks should handle unknown (NULL) dimensions
   as valid input.
 - [#464092]: Aspect Switcher -- Need to Flush Presets. Side-effect: now allows
@@ -38,7 +172,7 @@ Incompatibilities:
   file. This may cause current styles to not being able to find specified files
   anymore.
 - Custom actions: custom snippets are now executed using the PHP filter module,
-  meaning that the image syle editor must have the 'Use PHP for settings'
+  meaning that the image style editor must have the 'Use PHP for settings'
   permission to be able to edit the custom action snippet.
 - Custom actions: information and variables that are available in your custom
   snippet have changed. See the README.txt of the custom actions module.
@@ -54,6 +188,6 @@ coverage".
 
 Current and past maintainers for Imagecache Actions
 ---------------------------------------------------
-- dman (http://drupal.org/user/33240)
-- sidneyshan (http://drupal.org/user/652426)
-- fietserwin (http://drupal.org/user/750928)
+- dman (https://drupal.org/user/33240)
+- sidneyshan (https://drupal.org/user/652426)
+- fietserwin (https://drupal.org/user/750928)

+ 49 - 20
sites/all/modules/imagecache_actions/README.txt

@@ -1,15 +1,30 @@
 README for the Imagecache Actions Drupal module
 -----------------------------------------------
 
-Project page: http://drupal.org/project/imagecache_actions
+Project page: https://drupal.org/project/imagecache_actions
 
 Current and past maintainers for Imagecache Actions:
-- dman (http://drupal.org/user/33240)
-- sidneyshan (http://drupal.org/user/652426)
-- fietserwin (http://drupal.org/user/750928)
+- dman (https://drupal.org/user/33240)
+- sidneyshan (https://drupal.org/user/652426)
+- fietserwin (https://drupal.org/user/750928)
+
+
+Release notes for 7.x-1.x-dev
+-----------------------------
+- Clear all caches after updating.
+
+
+Release notes for 7.x-1.4
+-------------------------
+- This release supports image labels as introduced by Drupal 7.23.
+- See CHANGELOG.txt for a full overview of changes.
+
 
 Release notes for 7.x-1.1
 -------------------------
+- If you use the module:// notation anywhere in an image effect, you must now
+  install the System Stream Wrapper module
+  (https://drupal.org/project/system_stream_wrapper).
 - Clear the cache after updating.
 
 
@@ -57,27 +72,28 @@ The additional effects that Imagecache Actions provides include:
 - Text overlay: add e.g. a copyright notice to your image.
 - Color-shifting: colorize images.
 - Brighten/Darken.
-- Alpha blending: use a grayscale image to define the transparency layer of an
+- Alpha blending: use a gray scale image to define the transparency layer of an
   image.
-- Canvas manipulation: resize the canvas and add a backgroundcolor or image.
-- File Format switcher: if you need tranparency in JPGs, make them PNG. If your
+- Canvas manipulation: resize the canvas and add a background color or image.
+- File Format switcher: if you need transparency in JPGs, make them PNG. If your
   PNG thumbnails are 30K each, save them as JPGs.
 - Rounded corners.
-- TODO: complete list, check short descrptions
+- TODO: complete list, check short descriptions
 
-These effects are grouped in submodules. Just enable the ones you want to use.
-TODO: list submodules and their sets of effects.
+These effects are grouped in sub-modules. Just enable the ones you want to use.
+TODO: list sub-modules and their sets of effects.
 
 Imagecache Actions supports both the GD toolkit from Drupal core and the
 Imagemagick toolkit. However, please note that Imagemagick support is not yet
 complete. Please file an issue if you encounter problems in using Imagemagick.
 
+
 What is imagecache_action not?
 ------------------------------
 Imagecache Actions does not provide a new UI or new menu items. It hooks into
 the already existing image styles system (from Drupal core). See
-http://drupal.org/documentation/modules/image for more information about working
-with images.
+https://drupal.org/documentation/modules/image for more information about
+working with images.
 
 
 A note about the name of this module
@@ -90,7 +106,7 @@ porting to D7, that name has not been changed (yet).
 
 Which toolkit to use?
 ---------------------
-Personally, I (fieterwin) prefer the imagemagick toolkit:
+Personally, I (fietserwin) prefer the imagemagick toolkit:
 - It is better in anti-aliasing. Try to rotate an image using both toolkits and
   you will see what I mean.
 - It does not execute in the PHP memory space, so is not restricted by the
@@ -102,27 +118,36 @@ On the other hand: the GD toolkit is always available (in the correct version),
 whereas imagemagick is not always present on shared hosting or may be present in
 an antique version that might give problems.
 
-Please also note that effects may give different results depending on the
+Please note that effects may give different results depending on the
 toolkit used.
 
+Please also note that a 3rd image toolkit exists:
+  Imagick (https://www.drupal.org/project/imagick)
+This toolkit uses the Imagick extension and thus does not call the ImageMagick
+binaries directly. However our module does not implement the toolkit specific
+parts for the effects we provide for the Imagick toolkit, but the Imagick
+toolkit comes with its own set of effects that partly covers our effects. So,
+depending on the effects you require it may be a replacement for both our module
+and the Imagemagick module or the core GD toolkit.
 
 Hard Dependencies
 -----------------
-- Drupal 7.x
 - Image module from Drupal core
 
 At least 1 of the available image toolkits:
-- GD toolkit from Drupal core
-- Imagemagick toolkit: http://drupal.org/project/imagemagick
+- GD toolkit from Drupal core.
+- Imagemagick toolkit: https://drupal.org/project/imagemagick.
+
 
 Soft Dependencies
 -----------------
-- System stream wrapper (http://drupal.org/project/system_stream_wrapper)
-- Remote stream wrapper (http://drupal.org/project/remote_stream_wrapper)
+- System stream wrapper (https://drupal.org/project/system_stream_wrapper)
+- Remote stream wrapper (https://drupal.org/project/remote_stream_wrapper)
 These modules provide additional stream wrappers. Especially the system stream
 wrapper is very handy as it provides, among others, a module:// and theme://
 wrapper.
 
+
 Installing
 ----------
 As usual.
@@ -175,7 +200,6 @@ be defined using either:
 - A relative (to the current directory, probably Drupal root) or absolute path.
 
 
-
 Support
 -------
 Via the issue queue of this project at Drupal.org.
@@ -194,3 +218,8 @@ well).
 - Brightness values outside the -250 .. 250 range are accepted.
 - Check color fields that allow a transparency component or allow to be empty to
   specify fully transparent.
+
+Known problems: Imagemagick
+---------------------------
+- Define canvas using offsets may bot work on older versions. We have an error
+  report for version 6.5.4.7 (2009-07) (https://drupal.org/node/888644).

+ 112 - 90
sites/all/modules/imagecache_actions/ROADMAP.txt

@@ -1,90 +1,112 @@
-Imagecache Actions roadmap
---------------------------
-
-This is a non-contractual roadmap for the D7 branch of the imagecache actions
-module. Actual release dates and completed features will largely depend on
-available time. So support is always welcome. Furthermore, critical bugs may
-make us release more often, but that should only change the release number in
-which certain features are planned, not the timeline.
-
-
-Imagecache Actions 7.x-1.0
---------------------------
-Targeted release date: may 2012
-
-- (DONE) Clean up D7 issue queue
-- (DONE) Commit posted patches from the issue queue
-- (DONE) Solve easy to solve bug reports
-- Do some basic testing
-- (DONE) Reintroduce the text action, currently living in a sandbox project at
-  http://drupal.org/node/1090312
-- (DONE) Update README.txt
-- (DONE) Introduce CHANGELOG.txt
-- (DONE) Add this ROADMAP.txt
-
-
-Imagecache Actions 7.x-1.1
---------------------------
-Targeted release date: end 2012
-
-Mainly a bug fix release
-- (DONE) Solve remaining outstanding bug reports
-- (ALMOST DONE) Keep D7 issue queue clean
-
-
-Imagecache Actions 7.x-1.2
---------------------------
-Targeted release date: spring 2013
-
-- Check help and documentation. a.o: hook_help, effect descriptions.
-- Continue to keep the D7 issue queue clean.
-- Improve Imagemagick support and/or document what effects are not working for
-  which toolkit (version).
-- Check that all effects implement all of the effects API (especially the
-  dimensions callback).
-- Add testing. The idea is to create a set of image styles that cover all
-  effects and can be used to visually check for regressions.
-
-  Automated testing would be nice, but I am not sure that we can guarantee that
-  jpeg or png files are binary identical on each run across different computers.
-  But if the number of false positives is small, it would certainly be a useful
-  addition.
-
-
-Imagecache Actions 7.x-1.3
---------------------------
-Targeted release date: ...
-
-- Look at outstanding feature requests
-- Continue to keep the D7 issue queue clean
-- Keep improving Imagemagick support, a.o:
-  - Try to get insight into what version of imagemagick is required by what
-    effect.
-  - Document which effects might produce different results.
-- Refactor code
-  - Extract common form fields
-  - Extract common error handling
-  - (STARTED) Clean up comments, todo's, etc.
-  - (STARTED) Doxygen code documentation according to latest standards
-  - Increase the amount of lazy loaded code
-
-
-Imagecache Actions 7.x-2.x
---------------------------
-Targeted release date: ...
-
-- Can we refactor effects into auto loading class based plugins? What does
-  CTools offer in these? How do D8 core effects do this?
-- If so, will it make implementing new effects much simpler? Because that is
-  what we should strive for.
-- Should we rename the module to image_effects?
-- If we manage to provide an easy to use plugin system, we should strive to
-  merge with other modules that provide effects:
-  - FiltersIE module (http://drupal.org/project/filtersie)
-  - Imagecache Effects: http://drupal.org/project/imagecache_effects (D6 only,
-    but are their effects more advanced then our counterparts or do they add new
-    effects?)
-  - Image watermark: http://drupal.org/project/watermark (D5 only, but is their
-    watermark effect more advanced?)
-  - ImageCache Scale-9 Actions: http://drupal.org/project/imagecache_scale9actions
-  - etc.
+Imagecache Actions roadmap
+--------------------------
+
+This is a non-contractual roadmap for the D7 branch of the imagecache actions
+module. Actual release dates and completed features will largely depend on
+available time. So support is always welcome. Furthermore, critical bugs may
+make us release more often, but that should only change the release number in
+which certain features are planned, not the timeline.
+
+
+Imagecache Actions 7.x-1.0
+--------------------------
+Targeted release date: may 2012
+
+- (DONE) Clean up D7 issue queue
+- (DONE) Commit posted patches from the issue queue
+- (DONE) Solve easy to solve bug reports
+- Do some basic testing
+- (DONE) Reintroduce the text action, currently living in a sandbox project at
+  https://drupal.org/node/1090312
+- (DONE) Update README.txt
+- (DONE) Introduce CHANGELOG.txt
+- (DONE) Add this ROADMAP.txt
+
+
+Imagecache Actions 7.x-1.1
+--------------------------
+Targeted release date: end 2012
+
+Mainly a bug fix release
+- (DONE) Solve remaining outstanding bug reports
+- (ALMOST DONE) Keep D7 issue queue clean
+
+
+Imagecache Actions 7.x-1.2
+--------------------------
+Targeted release date: spring 2013
+
+- Check help and documentation. a.o: hook_help, effect descriptions.
+- (DONE) Continue to keep the D7 issue queue clean.
+- Improve Imagemagick support and/or document what effects are not working for
+  which toolkit (version).
+- (ALMOST DONE) Check that all effects implement all of the effects API (especially the
+  dimensions callback).
+- Add testing. The idea is to create a set of image styles that cover all
+  effects and can be used to visually check for regressions.
+
+  Automated testing would be nice, but I am not sure that we can guarantee that
+  jpeg or png files are binary identical on each run across different computers.
+  But if the number of false positives is small, it would certainly be a useful
+  addition.
+
+
+Imagecache Actions 7.x-1.3
+--------------------------
+Targeted release date: ...
+
+- Continue to keep the D7 issue queue clean.
+- Check help and documentation. a.o: hook_help, effect descriptions.
+- Improve Imagemagick support and/or document what effects are not working for
+  which toolkit (version).
+- Add testing. The idea is to create a set of image styles that cover all
+  effects and can be used to visually check for regressions.
+
+  Automated testing would be nice, but I am not sure that we can guarantee that
+  jpeg or png files are binary identical on each run across different computers.
+  But if the number of false positives is small, it would certainly be a useful
+  addition.
+- Refactor code:
+  - Extract common form fields.
+  - Extract common error handling.
+  - (STARTED) Clean up comments, todo's, etc.
+  - (STARTED) Doxygen code documentation according to latest standards
+  - Increase the amount of lazy loaded code.
+
+
+Imagecache Actions 7.x-1.5
+--------------------------
+Targeted release date: ...
+
+- Look at outstanding feature requests
+- Continue to keep the D7 issue queue clean.
+- Keep improving Imagemagick support, a.o:
+  - Try to get insight into what version of imagemagick is required by what
+    effect.
+  - Document which effects might produce different results.
+- Continue refactoring code:
+  - Extract common form fields.
+  - Extract common error handling.
+  - (STARTED) Clean up comments, todo's, etc.
+  - (STARTED) Doxygen code documentation according to latest standards.
+  - Increase the amount of lazy loaded code.
+
+
+Imagecache Actions 8.x-2.x
+--------------------------
+Targeted release date: ...
+
+- Convert image effects into plugins (as [#1821854] does for core).
+- This will make adding new effects much simpler, so we can easier add them.
+- Should we rename the module to image_effects?
+- We should strive to merge with other modules that provide image effects:
+  - FiltersIE module (https://drupal.org/project/filtersie)
+  - Imagecache Effects: https://drupal.org/project/imagecache_effects (D6 only,
+    but are their effects more advanced then our counterparts or do they add new
+    effects?)
+  - Image watermark: https://drupal.org/project/watermark (D5 only, but is their
+    watermark effect more advanced?)
+  - ImageCache Scale-9 Actions: https://drupal.org/project/imagecache_scale9actions
+  - ImageEffects: https://drupal.org/project/imageeffects (pixelate and flip).
+  - Imagick: https://www.drupal.org/project/imagick
+  - etc.

+ 4 - 7
sites/all/modules/imagecache_actions/autorotate/imagecache_autorotate.info

@@ -1,16 +1,13 @@
 name = Imagecache Autorotate
-description = Autorotate image based on EXIF Orientation.
+description = Provides an image effect to autorotate an image based on EXIF data.
 package = Media
 core = 7.x
 
 dependencies[] = image
 
-files[] = imagecache_autorotate.install
-files[] = imagecache_autorotate.module
-
-; Information added by drupal.org packaging script on 2012-12-04
-version = "7.x-1.1"
+; Information added by Drupal.org packaging script on 2018-03-20
+version = "7.x-1.9"
 core = "7.x"
 project = "imagecache_actions"
-datestamp = "1354653754"
+datestamp = "1521550387"
 

+ 19 - 7
sites/all/modules/imagecache_actions/autorotate/imagecache_autorotate.install

@@ -1,13 +1,25 @@
 <?php
 /**
- * @file (un)install and (dis/en)able hooks for imagecache autorotate module.
+ * Implements hook_requirements().
  */
+function imagecache_autorotate_requirements($phase) {
+  $result = array();
+  $t = get_t();
+  if (!extension_loaded('exif')) {
+    $result['imagecache_autorotate_exif_extension'] = array(
+      'title'=> 'EXIF extension',
+      'value'=> $phase === 'runtime' ? $t('Disabled') : '',
+      'description'=> $t('The autorotate image effect requires the exif extension to be enabled.'),
+      'severity' => REQUIREMENT_ERROR,
+    );
+  }
+  else {
+    $result['imagecache_autorotate_exif_extension'] = array(
+      'title'=> 'EXIF extension',
+      'value'=> $t('Enabled'),
+      'severity' => REQUIREMENT_OK,
+    );
 
-/**
- * Implements hook_enable().
- */
-function imagecache_autorotate_enable() {
-  if (!function_exists('exif_read_data')) {
-    drupal_set_message(t('The exif_read_data() function is not available in this PHP installation. You probably will have to enable the exif extension.'), 'warning');
   }
+  return $result;
 }

+ 177 - 78
sites/all/modules/imagecache_actions/autorotate/imagecache_autorotate.module

@@ -1,61 +1,71 @@
 <?php
 /**
- * @file
- * Autorotate image based on EXIF Orientation tag.
- * http://sylvana.net/jpegcrop/exif_orientation.html
+ * @file Autorotate image based on EXIF Orientation tag.
  *
- * This mini-module contributed by jonathan_hunt http://drupal.org/user/28976
- * September 1, 2009
+ * EXIF: https://en.wikipedia.org/wiki/Exchangeable_image_file_format
+ * EXIF orientation tag: http://sylvana.net/jpegcrop/exif_orientation.html
  *
- * Tweaked by dman to add documentation
+ * Originally contributed by jonathan_hunt https://drupal.org/user/28976,
+ * September 1, 2009
  */
 
-/* In Adobe PNGs and TIFF, this information MAY be present in the XMP
- * metadata like so:
-
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
- <rdf:Description rdf:about="" xmlns:tiff="http://ns.adobe.com/tiff/1.0/">
- <tiff:Orientation>6</tiff:Orientation>
- </rdf:Description>
- </rdf:RDF>
- </x:xmpmeta>
-
+/**
+ * Implements hook_image_effect_info().
+ *
+ * Defines information about the supported effects.
  */
-
 function imagecache_autorotate_image_effect_info() {
   $effects = array();
 
   $effects['imagecache_autorotate'] = array(
     'label' => t('Autorotate'),
-    'help' => t('Add autorotate image based on EXIF Orientation.'),
-    'effect callback' => 'imagecache_autorotate_image',
+    'help' => t('Autorotate image based on EXIF orientation and reset that tag.'),
+    'effect callback' => 'imagecache_autorotate_effect',
     'dimensions callback' => 'imagecache_autorotate_dimensions',
+    'form callback' => 'imagecache_autorotate_form',
+    'summary theme' => 'imagecache_autorotate_summary',
   );
 
   return $effects;
 }
 
 /**
- * @todo: This form is no longer needed nor defined in the hook above. If this
- * information still needs to be displayed it should probably be moved to help.
+ * Implements hook_theme().
+ *
+ * Registers theme functions for the effect summaries.
+ */
+function imagecache_autorotate_theme() {
+  return array(
+    'imagecache_autorotate_summary' => array(
+      'variables' => array('data' => NULL),
+    ),
+  );
+}
+
+/**
+ * Builds the auto-rotate form.
+ *
+ * This effect has no options, only some help text, so the form is displayed
+ * anyway.
  */
 function imagecache_autorotate_form() {
   $form = array();
   $form['help'] = array(
-    '#type' => 'markup',
-    '#value' => "<p>
-      <b>There are no user-configurable options for this process.</b>
-      </p><p>
-      Certain cameras can embed <em>orientation</em> information into image
+    '#markup' => "<p><strong>There are no user-configurable options for this process.</strong></p>
+      <p>Certain cameras can embed <em>orientation</em> information into image
       files when they save them. This information is embedded in an EXIF tag
       and can be used to rotate images to their correct position for display.
-      </p><p>
       <em>Not all cameras or images contain this information.</em>
-      This process is only useful for those that do.
-      </p><p>
-      The expected/supported values are
-      <br/><strong>Tag</strong>: <code>0x0112  Orientation</code>
+      This process is only useful for images that contain this information,
+      whereas for other images it is harmless.
+      </p>
+      <p>Although most modern browsers do support the orientation tag, the
+      information may get lost or become incorrect by other operations.
+      So, to support all browsers and prevent rotation errors, it is better to
+      start each image style with this effect.
+      </p>
+      <p>The expected/supported values are:<br/>
+      <strong>Tag</strong>: <code>0x0112  Orientation</code>
       </p>
       <ul>
       <li>1 = Horizontal (normal)</li>
@@ -63,83 +73,172 @@ function imagecache_autorotate_form() {
       <li>6 = Rotate 90 CW</li>
       <li>8 = Rotate 270 CW</li>
       </ul>
-      <p>
-      <a href='http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html'>
-EXIF Reference</a>
-      </p>
+      <p>Wikipedia: <a href='https://en.wikipedia.org/wiki/Exchangeable_image_file_format'>Exchangeable image file format</a></p>
     ",
   );
   return $form;
 }
 
 /**
- * Autorotate image based on EXIF Orientation tag.
+ * Implements theme_hook() for the autorotate effect summary.
+ *
+ * param array $variables
+ *   An associative array containing:
+ *   - data: The current configuration for this image effect.
  *
- * See code at
- * http://sylvana.net/jpegcrop/exif_orientation.html
+ * @return string
+ *   The HTML for the summary of this image effect.
+ * @ingroup themeable
+ */
+function theme_imagecache_autorotate_summary(/*array $variables*/) {
+  return 'image based on its EXIF data.';
+}
+
+/**
+ * Autorotate image based on EXIF Orientation tag.
+ */
+function imagecache_autorotate_effect(stdClass $image /*, $data*/) {
+  // Test to see if EXIF is supported by the current image type.
+  if (in_array($image->info['mime_type'], array('image/jpeg', 'image/tiff'))) {
+    // Hand over to toolkit.
+    return image_toolkit_invoke('imagecache_autorotate', $image);
+  }
+  else if ($image->source === 'modules/image/sample.png' && user_access('administer image styles')) {
+    if (!extension_loaded('exif')) {
+      // Issue a warning if we are in the admin screen and the exif extension is
+      // not enabled.
+      drupal_set_message(t('The autorotate image effect requires the exif extension to be enabled.'), 'warning');
+      if ($image->toolkit === 'imagemagick') {
+        drupal_set_message(t('Though imagemagick will work without the exif extension, subsequent effects may fail as the image dimensions cannot be updated.'), 'warning');
+      }
+    }
+  }
+  return TRUE;
+}
+
+/**
+ * GD toolkit specific implementation of this image effect.
  *
- * and reference at
- * http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html
+ * @param stdClass $image
  *
- * @todo:
- * Add horizontal and vertical flips etc.
- * Need to create sample set for tests.
+ * @return bool
+ *   true on success, false otherwise.
  */
-function imagecache_autorotate_image($image, $data) {
-  // Test to see if EXIF is supported for image type (e.g. not PNG).
-  if ($image->info['mime_type'] == 'image/jpeg') {
-    if (!function_exists('exif_read_data')) {
-      watchdog('image', 'The image %file could not be auto-rotated because the exif_read_data() function is not available in this PHP installation. You probably will have to enable the exif extension.', array('%file' => $image->source));
-      return FALSE;
+function image_gd_imagecache_autorotate(stdClass $image) {
+  if (!function_exists('exif_read_data')) {
+    watchdog('imagecache_actions', 'Image %file could not be auto-rotated: !message', array('%file' => $image->source, '!message' => t('The exif_read_data() function is not available in this PHP installation. You probably have to enable the exif extension.')));
+    return FALSE;
+  }
+
+  // Read and check result.
+  $exif = @exif_read_data(drupal_realpath($image->source));
+  if ($exif === FALSE && $image->extension === 'jpg') {
+    watchdog('imagecache_actions', 'Image %file could not be auto-rotated: !message', array('%file' => $image->source, '!message' => t('The exif_read_data() function returned FALSE.')));
+    return FALSE;
+  }
+
+  if (isset($exif['Orientation'])) {
+    // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html:
+    // 1 = Horizontal (normal)
+    // 2 = Mirror horizontal
+    // 3 = Rotate 180
+    // 4 = Mirror vertical
+    // 5 = Mirror horizontal and rotate 270 CW
+    // 6 = Rotate 90 CW
+    // 7 = Mirror horizontal and rotate 90 CW
+    // 8 = Rotate 270 CW
+    // @todo: Add horizontal and vertical flips etc.
+    // imagecopy seems to be able to mirror, see conmments on
+    // http://php.net/manual/en/function.imagecopy.php
+    // @todo: Create sample set for tests.
+    switch ($exif['Orientation']) {
+      case 3:
+        $degrees = 180;
+        break;
+      case 6:
+        $degrees = 90;
+        break;
+      case 8:
+        $degrees = 270;
+        break;
+      default:
+        $degrees = 0;
     }
-    $exif = exif_read_data(drupal_realpath($image->source));
+    if ($degrees != 0) {
+      return image_rotate($image, $degrees);
+    }
+  }
+  return TRUE;
+}
+
+/**
+ * Imagemagick toolkit specific implementation of this image effect.
+ *
+ * @param stdClass $image
+ *   An image object.
+ *
+ * @return bool
+ *   true on success, false otherwise.
+ *
+ * @see http://www.imagemagick.org/script/command-line-options.php#auto-orient
+ */
+function image_imagemagick_imagecache_autorotate(stdClass $image) {
+  // Use the exif extension, if enabled, to figure out the new dimensions.
+  // Moreover (see [#2366163]): to prevent a bug in IM to incorrectly rotate the
+  // image when it should not, we only pass the auto-orient argument when the
+  // exif extension could detect the 'Orientation' tag.
+  if (function_exists('exif_read_data')) {
+    $exif = @exif_read_data(drupal_realpath($image->source));
     if (isset($exif['Orientation'])) {
       switch ($exif['Orientation']) {
-        case 3:
-          $degrees = 180;
+        case 1:
+          // Normal orientation: no need to rotate or to change the dimensions.
           break;
+        case 5:
         case 6:
-          $degrees = 90;
-          break;
+        case 7:
         case 8:
-          $degrees = 270;
+          // 90 or 270 degrees rotation (+ optional mirror): swap dimensions.
+          $image->ops[] = '-auto-orient';
+          $tmp = $image->info['width'];
+          $image->info['width'] = $image->info['height'];
+          $image->info['height'] = $tmp;
           break;
         default:
-          $degrees = 0;
-      }
-      if ($degrees != 0) {
-        $org_width = $image->info['width'];
-        $org_height = $image->info['height'];
-        image_rotate($image, $degrees);
-        if (($degrees === 90 || $degrees === 270) && $image->info['width'] === $org_width) {
-          // The toolkit failed to alter the dimensions (imagemagick currently
-          // fails to do so). So we do it ourselves.
-          $image->info['width'] = $org_height;
-          $image->info['height'] = $org_width;
-        }
+          // All other orientations: pass the arguments, but the dimensions
+          // remain the same.
+          $image->ops[] = '-auto-orient';
+          break;
       }
     }
+    elseif ($exif === FALSE && $image->extension === 'jpg') {
+      watchdog('imagecache_actions', 'Image %file could not be auto-rotated: !message', array('%file' => $image->source, '!message' => t('The exif_read_data() function returned FALSE.')));
+    }
   }
-  else if ($image->source === 'modules/image/sample.png' && !function_exists('exif_read_data')) {
-    // Issue a warning if we are in the admin screen and the exif extension is
-    // not enabled.
-    drupal_set_message(t('The exif_read_data() function is not available in this PHP installation. You probably will have to enable the exif extension.'), 'warning');
+  else {
+    // We do add the auto-orient argument to IM. IM will determine itself
+    // whether to rotate or not.
+    $image->ops[] = '-auto-orient';
+    // However we cannot keep track of the dimensions anymore.
+    if ($image->info['width'] !== $image->info['height']) {
+      $image->info['width'] = $image->info['height'] = NULL;;
+    }
   }
   return TRUE;
 }
 
 /**
- * Image dimensions callback; Auto-rotate.
+ * Image dimensions callback for this image effect.
  *
  * @param array $dimensions
  *   An array with the dimensions (in pixels) to be modified.
- * @param array $data
- *   An array of parameters for the autorotate effect (empty for this effect).
-*/
-function imagecache_autorotate_dimensions(array &$dimensions, array $data) {
+ * param array $data
+ *   An associative array containing the effect data.
+ */
+function imagecache_autorotate_dimensions(array &$dimensions/*, array $data*/) {
   // We can only know the resulting dimensions if both dimensions are equal.
   // Otherwise we need to inspect the image itself, which is not passed in here.
-  // (this callback was introduced to enhance performance by not accessing the
+  // (this callback was introduced to enhance performance by NOT accessing the
   // image file when rendering the width and height attributes of the html img
   // tag).
   if ($dimensions['width'] !== $dimensions['height']) {

BIN
sites/all/modules/imagecache_actions/autorotate/portrait-painting.jpg


File diff suppressed because it is too large
+ 1054 - 213
sites/all/modules/imagecache_actions/canvasactions/canvasactions.inc


+ 4 - 21
sites/all/modules/imagecache_actions/canvasactions/imagecache_canvasactions.info

@@ -1,31 +1,14 @@
 name = Imagecache Canvas Actions
-description = Actions for manipulating image canvases layers, including watermark and background effect. Also an aspect switcher (portrait/landscape)
+description = Provides image effects for manipulating image canvases: define canvas, image mask, watermark, underlay background image, rounded corners, composite source to image and resize by percent effect. Also provides an aspect switcher (portrait/landscape).
 package = Media
 core = 7.x
 
 dependencies[] = imagecache_actions
 dependencies[] = image
 
-files[] = canvasactions.inc
-files[] = imagecache_canvasactions.install
-files[] = imagecache_canvasactions.module
-files[] = rounded_corners.inc
-files[] = tests/cheap_dropshadow.imagecache_preset.inc
-files[] = tests/keyword_positioning.imagecache_preset.inc
-files[] = tests/positioned_underlay.imagecache_preset.inc
-files[] = tests/rotate_alpha.imagecache_preset.inc
-files[] = tests/rotate_alpha_gif.imagecache_preset.inc
-files[] = tests/rotate_scale.imagecache_preset.inc
-files[] = tests/rotate_scale_alpha.imagecache_preset.inc
-files[] = tests/rounded.imagecache_preset.inc
-files[] = tests/rounded_bl.imagecache_preset.inc
-files[] = tests/rounded_flattened.imagecache_preset.inc
-files[] = tests/watermark_100.imagecache_preset.inc
-files[] = tests/watermark_50.imagecache_preset.inc
-
-; Information added by drupal.org packaging script on 2012-12-04
-version = "7.x-1.1"
+; Information added by Drupal.org packaging script on 2018-03-20
+version = "7.x-1.9"
 core = "7.x"
 project = "imagecache_actions"
-datestamp = "1354653754"
+datestamp = "1521550387"
 

+ 0 - 27
sites/all/modules/imagecache_actions/canvasactions/imagecache_canvasactions.install

@@ -1,27 +0,0 @@
-<?php
-
-/**
- * @file Set up new canvas actions. Tell imagecache.module about them
- */
-
-/**
- * Need to flush the cache when this module is enabled or disabled
- */
-function imagecache_canvasactions_install() {
-  if (function_exists('imagecache_action_definitions') ) {
-    imagecache_action_definitions(TRUE);
-  }
-  cache_clear_all('imagecache_actions', 'cache');
-  drupal_set_message(t('Additional image style actions should now be available in the presets !settings_link', array('!settings_link' => l(t('settings'), 'admin/config/media/image-styles'))));
-}
-
-/**
- * @todo Please document this function.
- * @see http://drupal.org/node/1354
- */
-function imagecache_canvasactions_uninstall() {
-  if (function_exists('imagecache_action_definitions') ) {
-    imagecache_action_definitions(TRUE);
-  }
-  cache_clear_all('imagecache_actions', 'cache');
-}

+ 74 - 25
sites/all/modules/imagecache_actions/canvasactions/imagecache_canvasactions.module

@@ -5,7 +5,7 @@
  * including "Watermark"
  *
  * Based on first draft of the code by Dimm (imagecache.module 5--1)
- * http://drupal.org/node/184816
+ * https://drupal.org/node/184816
  *
  * Rewritten and ported to Imagecache actions API (imagecache.module 5--2) by
  * dman http://coders.co.nz/
@@ -39,21 +39,20 @@
  *
  */
 
-// During devel, caching is pointless. Flush it
-// imagecache_action_definitions(TRUE);
-
 if (! function_exists('imagecache_actions_calculate_relative_position') ) {
-  module_load_include('inc', 'imagecache_canvasactions', 'utility');
+  module_load_include('inc', 'imagecache_actions', 'utility');
 }
 
 // @todo There doesn't seem to be a way to specify a file in hook_image_effect_info
 // so placing this here for the time being.
 module_load_include('inc', 'imagecache_canvasactions', 'canvasactions');
 module_load_include('inc', 'imagecache_canvasactions', 'rounded_corners');
-// imageapi extensions
-module_load_include('inc', 'imagcache_actions', 'image_overlay.inc');
-
 
+/**
+ * Implements hook_image_effect_info().
+ *
+ * Defines information about the supported effects.
+ */
 function imagecache_canvasactions_image_effect_info() {
   $effects = array();
 
@@ -69,8 +68,8 @@ function imagecache_canvasactions_image_effect_info() {
   $effects['canvasactions_imagemask'] = array(
     'label' => t('Image mask'),
     'help' => t(' Choose the file image you wish to use as a mask, and apply it to the canvas.'),
-    'effect callback' => 'canvasactions_imagemask_image',
     'dimensions passthrough' => TRUE,
+    'effect callback' => 'canvasactions_imagemask_effect',
     'form callback' => 'canvasactions_imagemask_form',
     'summary theme' => 'canvasactions_imagemask_summary',
   );
@@ -78,8 +77,8 @@ function imagecache_canvasactions_image_effect_info() {
   $effects['canvasactions_file2canvas'] = array(
     'label' => t('Overlay (watermark)'),
     'help' => t('Choose the file image you wish to use as an overlay, and position it in a layer on top of the canvas.'),
-    'effect callback' => 'canvasactions_file2canvas_image',
     'dimensions passthrough' => TRUE,
+    'effect callback' => 'canvasactions_file2canvas_effect',
     'form callback' => 'canvasactions_file2canvas_form',
     'summary theme' => 'canvasactions_file2canvas_summary',
   );
@@ -87,7 +86,7 @@ function imagecache_canvasactions_image_effect_info() {
   $effects['canvasactions_canvas2file'] = array(
     'label' => t('Underlay (background)'),
     'help' => t('Choose the file image you wish to use as an background, and position the processed image on it.'),
-    'effect callback' => 'canvasactions_canvas2file_image',
+    'effect callback' => 'canvasactions_canvas2file_effect',
     'dimensions callback' => 'canvasactions_canvas2file_dimensions',
     'form callback' => 'canvasactions_canvas2file_form',
     'summary theme' => 'canvasactions_canvas2file_summary',
@@ -96,8 +95,8 @@ function imagecache_canvasactions_image_effect_info() {
   $effects['canvasactions_source2canvas'] = array(
     'label' => t('Overlay: source image to canvas'),
     'help' => t('Places the source image onto the canvas for compositing.'),
-    'effect callback' => 'canvasactions_source2canvas_image',
     'dimensions passthrough' => TRUE,
+    'effect callback' => 'canvasactions_source2canvas_effect',
     'form callback' => 'canvasactions_source2canvas_form',
     'summary theme' => 'canvasactions_source2canvas_summary',
   );
@@ -105,8 +104,8 @@ function imagecache_canvasactions_image_effect_info() {
   $effects['canvasactions_roundedcorners'] = array(
     'label' => t('Rounded Corners'),
     'help' => t('This is true cropping, not overlays, so the result <em>can</em> be transparent.'),
-    'effect callback' => 'canvasactions_roundedcorners_image',
     'dimensions passthrough' => TRUE,
+    'effect callback' => 'canvasactions_roundedcorners_effect',
     'form callback' => 'canvasactions_roundedcorners_form',
     'summary theme' => 'canvasactions_roundedcorners_summary',
   );
@@ -114,55 +113,105 @@ function imagecache_canvasactions_image_effect_info() {
   $effects['canvasactions_aspect'] = array(
     'label' => t('Aspect switcher'),
     'help' => t('Use different effects depending on whether the image is landscape of portrait shaped. This re-uses other preset definitions, and just chooses between them based on the rule.'),
-    'effect callback' => 'canvasactions_aspect_image',
+    'effect callback' => 'canvasactions_aspect_effect',
     'dimensions callback' => 'canvasactions_aspect_dimensions',
     'form callback' => 'canvasactions_aspect_form',
     'summary theme' => 'canvasactions_aspect_summary',
   );
 
+  $effects['canvasactions_resizepercent'] = array(
+    'label' => t('Resize (percent)'),
+    'help' => t('Resize the image based on percent. If only a single dimension is specified, the other dimension will be calculated.'),
+    'effect callback' => 'canvasactions_resizepercent_effect',
+    'dimensions callback' => 'canvasactions_resizepercent_dimensions',
+    'form callback' => 'canvasactions_resizepercent_form',
+    'summary theme' => 'canvasactions_resizepercent_summary',
+  );
+
+  $effects['canvasactions_blur'] = array(
+    'label' => t('Blur'),
+    'help' => t('Make the image become unclear.'),
+    'effect callback' => 'canvasactions_blur_effect',
+    'dimensions passthrough' => TRUE,
+    'form callback' => 'canvasactions_blur_form',
+    'summary theme' => 'canvasactions_blur_summary',
+  );
+
+  $effects['canvasactions_interlace'] = array(
+    'label' => t('Interlace / Progressive'),
+    'help' => t('Create interlaced PNG/GIF or progressive JPG.'),
+    'effect callback' => 'canvasactions_interlace_effect',
+    'dimensions passthrough' => TRUE,
+    'form callback' => 'canvasactions_interlace_form',
+  );
+
+  $effects['canvasactions_perspective'] = array(
+    'label' => t('Perspective transform'),
+    'help' => t('Adds a perspective transformation to the image.'),
+    'effect callback' => 'canvasactions_perspective_effect',
+    'dimensions passthrough' => TRUE,
+    'form callback' => 'canvasactions_perspective_form',
+    'summary theme' => 'canvasactions_perspective_summary',
+  );
+
   return $effects;
 }
 
-
 /**
- * Need to register the theme functions we expect to use
+ * Implements hook_theme().
+ *
+ * Registers theme functions for the effect summaries.
  */
 function imagecache_canvasactions_theme() {
-  $util_dir = drupal_get_path('module', 'imagecache_actions');
   return array(
     'canvasactions_definecanvas_summary' => array(
-      'file' => 'canvasactions.inc',
       'variables' => array('data' => NULL),
+      'file' => 'canvasactions.inc',
     ),
     'canvasactions_imagemask_summary' => array(
-      'file'      => 'canvasactions.inc',
       'arguments' => array('element' => NULL),
+      'file' => 'canvasactions.inc',
     ),
     'canvasactions_file2canvas_summary' => array(
-      'file' => 'canvasactions.inc',
       'variables' => array('data' => NULL),
+      'file' => 'canvasactions.inc',
     ),
     'canvasactions_source2canvas_summary' => array(
-      'file' => 'canvasactions.inc',
       'variables' => array('data' => NULL),
+      'file' => 'canvasactions.inc',
     ),
     'canvasactions_canvas2file_summary' => array(
-      'file' => 'canvasactions.inc',
       'variables' => array('data' => NULL),
+      'file' => 'canvasactions.inc',
     ),
     'canvasactions_roundedcorners_summary' => array(
-      'file' => 'rounded_corners.inc',
       'variables' => array('data' => NULL),
+      'file' => 'canvasactions.inc',
     ),
     'canvasactions_aspect_summary' => array(
+      'variables' => array('data' => NULL),
       'file' => 'canvasactions.inc',
+    ),
+    'canvasactions_resizepercent_summary' => array(
       'variables' => array('data' => NULL),
+      'file' => 'canvasactions.inc',
+    ),
+    'canvasactions_blur_summary' => array(
+      'variables' => array('data' => NULL),
+      'file' => 'canvasactions.inc',
+    ),
+    'canvasactions_perspective_summary' => array(
+      'variables' => array('data' => NULL),
+      'file' => 'canvasactions.inc',
+    ),
+    'canvasactions_perspective_anchor' => array(
+      'render element' => 'element',
     ),
   );
 }
 
 /**
- * Implements hook_image_style_flush.
+ * Implements hook_image_style_flush().
  *
  * This hook checks if the image style that is being flushed is used in an
  * aspect switcher effect. If so, the style that contains the aspect switcher
@@ -171,7 +220,7 @@ function imagecache_canvasactions_theme() {
  * @param array $flushed_style
  *   The image style that is being flushed.
  */
-function imagecache_canvasactions_image_style_flush($flushed_style) {
+function imagecache_canvasactions_image_style_flush(/*array*/ $flushed_style) {
   $styles = image_styles();
   foreach ($styles as $style) {
     if ($style['name'] !== $flushed_style['name']) {

+ 9 - 5
sites/all/modules/imagecache_actions/canvasactions/rounded_corners.inc

@@ -60,6 +60,11 @@ function canvasactions_roundedcorners_form($action) {
   $form['independent_corners_set']['radii'] = array(
     '#type' => 'item',
     '#id' => 'independent-corners-set',
+    '#states' => array(
+      'visible' => array(
+        ':input[name="data[independent_corners_set][independent_corners]"]' => array('checked' => TRUE),
+      ),
+    ),
   );
   foreach ($corners as $attribute => $label) {
     $form['independent_corners_set']['radii'][$attribute] = array(
@@ -79,8 +84,7 @@ function canvasactions_roundedcorners_form($action) {
    );
    */
   $form['notes'] = array(
-    '#type' => 'markup',
-    '#value' => t('
+    '#markup' => t('
         Note: the rounded corners effect uses true alpha transparency masking.
         This means that this effect <b>will fail to be saved</b> on jpegs
         <em>unless</em> you either <ul>
@@ -97,7 +101,7 @@ function canvasactions_roundedcorners_form($action) {
   return $form;
 }
 
-function canvasactions_roundedcorners_image($image, $action = array()) {
+function canvasactions_roundedcorners_effect($image, $action) {
   $independent_corners = !empty($action['independent_corners_set']['independent_corners']);
   if (!$independent_corners) {
     // set the independant corners to all be the same.
@@ -125,7 +129,7 @@ function canvasactions_roundedcorners_image($image, $action = array()) {
  * @param $image
  * @param $action
  */
-function image_gd_roundedcorners($image, $action = array()) {
+function image_gd_roundedcorners($image, $action) {
   // Read settings.
   $width = $image->info['width'];
   $height = $image->info['height'];
@@ -266,7 +270,7 @@ function _canvasactions_roundedcorners_pixel_opacity($x, $y, $r) {
 /**
  * imageapi_roundedcorners
  */
-function image_imagemagick_roundedcorners($image, $action = array()) {
+function image_imagemagick_roundedcorners($image, $action) {
   // Based on the imagemagick documentation.
   // http://www.imagemagick.org/Usage/thumbnails/#rounded
   // Create arc cut-outs, then mask them.

+ 20 - 19
sites/all/modules/imagecache_actions/canvasactions/tests/cheap_dropshadow.imagecache_preset.inc

@@ -1,9 +1,8 @@
 <?php
-// $ID:  $
 /**
  * @file
  *   Test imagecache preset.
- * 
+ *
  * Created on Dec 29, 2009
  *
  * @author 'dman' Dan Morrison http://coders.co.nz/
@@ -12,7 +11,7 @@
 $presets['cheap_dropshadow'] = array (
   'name' => 'cheap_dropshadow',
   '#weight' => '3.3',
-  'effects' => 
+  'effects' =>
   array (
     -1 => array (
       'weight' => '-1',
@@ -20,28 +19,29 @@ $presets['cheap_dropshadow'] = array (
       'name' => 'coloractions_convert',
       'data' => array (
         'format' => 'image/png',
+        'quality' => '95',
       ),
     ),
-    0 => 
+    0 =>
     array (
       'weight' => '0',
       'module' => 'imagecache_canvasactions',
       'name' => 'canvasactions_definecanvas',
-      'data' => 
+      'data' =>
       array (
-        'RGB' => 
+        'RGB' =>
         array (
           'HEX' => '999999',
         ),
         'under' => 0,
-        'exact' => 
+        'exact' =>
         array (
           'width' => '',
           'height' => '',
           'xpos' => 'center',
           'ypos' => 'center',
         ),
-        'relative' => 
+        'relative' =>
         array (
           'leftdiff' => '0',
           'rightdiff' => '0',
@@ -50,26 +50,26 @@ $presets['cheap_dropshadow'] = array (
         ),
       ),
     ),
-    1 => 
+    1 =>
     array (
       'weight' => '1',
       'module' => 'imagecache_canvasactions',
       'name' => 'canvasactions_definecanvas',
-      'data' => 
+      'data' =>
       array (
-        'RGB' => 
+        'RGB' =>
         array (
           'HEX' => '',
         ),
         'under' => 1,
-        'exact' => 
+        'exact' =>
         array (
           'width' => '',
           'height' => '',
           'xpos' => 'center',
           'ypos' => 'center',
         ),
-        'relative' => 
+        'relative' =>
         array (
           'leftdiff' => '20',
           'rightdiff' => '0',
@@ -78,27 +78,27 @@ $presets['cheap_dropshadow'] = array (
         ),
       ),
     ),
-    2 => 
+    2 =>
     array (
       'weight' => '2',
       'module' => 'imagecache_canvasactions',
       'name' => 'canvasactions_source2canvas',
-      'data' => 
+      'data' =>
       array (
         'xpos' => 0,
         'ypos' => 0,
         'alpha' => '100',
       ),
     ),
-    3 => 
+    3 =>
     array (
       'weight' => '3',
       'module' => 'image',
       'name' => 'image_scale',
-      'data' => 
+      'data' =>
       array (
         'width' => '200',
-        'height' => '100%',
+        'height' => '',
         'upscale' => 0,
       ),
     ),
@@ -108,7 +108,8 @@ $presets['cheap_dropshadow'] = array (
       'name' => 'coloractions_convert',
       'data' => array (
         'format' => 'image/png',
+        'quality' => '95',
       ),
     ),
   ),
-);
+);

+ 0 - 1
sites/all/modules/imagecache_actions/canvasactions/tests/keyword_positioning.imagecache_preset.inc

@@ -1,5 +1,4 @@
 <?php
-// $ID:  $
 /**
  * @file
  *   Test imagecache preset.

+ 3 - 3
sites/all/modules/imagecache_actions/canvasactions/tests/positioned_underlay.imagecache_preset.inc

@@ -1,9 +1,8 @@
 <?php
-// $ID:  $
 /**
  * @file
  *   Test imagecache preset.
- * 
+ *
  * Created on Dec 29, 2009
  *
  * @author 'dman' Dan Morrison http://coders.co.nz/
@@ -41,7 +40,8 @@ $presets['positioned_underlay'] = array (
       'name' => 'coloractions_convert',
       'data' => array (
         'format' => 'image/png',
+        'quality' => '95',
       ),
     ),
   ),
-);
+);

+ 4 - 4
sites/all/modules/imagecache_actions/canvasactions/tests/rotate_alpha.imagecache_preset.inc

@@ -1,9 +1,8 @@
 <?php
-// $ID:  $
 /**
  * @file
  *   Test imagecache preset.
- * 
+ *
  * Created on Dec 29, 2009
  *
  * @author 'dman' Dan Morrison http://coders.co.nz/
@@ -17,7 +16,7 @@ $presets['rotate_alpha'] = array (
       'weight' => '1',
       'module' => 'image',
       'name' => 'image_rotate',
-      'data' => array (        
+      'data' => array (
         'degrees' => '15',
         'random' => 0,
         'bgcolor' => '',
@@ -29,7 +28,8 @@ $presets['rotate_alpha'] = array (
       'name' => 'coloractions_convert',
       'data' => array (
         'format' => 'image/png',
+        'quality' => '95',
       ),
     ),
   ),
-);
+);

+ 4 - 4
sites/all/modules/imagecache_actions/canvasactions/tests/rotate_alpha_gif.imagecache_preset.inc

@@ -1,9 +1,8 @@
 <?php
-// $ID:  $
 /**
  * @file
  *   Test imagecache preset.
- * 
+ *
  * Created on Dec 29, 2009
  *
  * @author 'dman' Dan Morrison http://coders.co.nz/
@@ -18,7 +17,7 @@ $presets['rotate_alpha_gif'] = array (
       'weight' => '1',
       'module' => 'image',
       'name' => 'image_rotate',
-      'data' => array (        
+      'data' => array (
         'degrees' => '15',
         'random' => 0,
         'bgcolor' => '',
@@ -30,7 +29,8 @@ $presets['rotate_alpha_gif'] = array (
       'name' => 'coloractions_convert',
       'data' => array (
         'format' => 'image/gif',
+        'quality' => '75',
       ),
     ),
   ),
-);
+);

+ 0 - 1
sites/all/modules/imagecache_actions/canvasactions/tests/rotate_scale.imagecache_preset.inc

@@ -1,5 +1,4 @@
 <?php
-// $ID:  $
 /**
  * @file
  *   Test imagecache preset.

+ 5 - 4
sites/all/modules/imagecache_actions/canvasactions/tests/rotate_scale_alpha.imagecache_preset.inc

@@ -1,9 +1,8 @@
 <?php
-// $ID:  $
 /**
  * @file
  *   Test imagecache preset.
- * 
+ *
  * Created on Dec 29, 2009
  *
  * @author 'dman' Dan Morrison http://coders.co.nz/
@@ -18,7 +17,7 @@ $presets['rotate_scale_alpha'] = array (
       'weight' => '1',
       'module' => 'image',
       'name' => 'image_rotate',
-      'data' => array (        
+      'data' => array (
         'degrees' => '65',
         'random' => 0,
         'bgcolor' => '',
@@ -33,6 +32,7 @@ $presets['rotate_scale_alpha'] = array (
       'name' => 'coloractions_convert',
       'data' => array (
         'format' => 'image/png',
+        'quality' => '95',
       ),
     ),
     */
@@ -52,8 +52,9 @@ $presets['rotate_scale_alpha'] = array (
       'name' => 'coloractions_convert',
       'data' => array (
         'format' => 'image/png',
+        'quality' => '95',
       ),
     ),
 
   ),
-);
+);

+ 3 - 3
sites/all/modules/imagecache_actions/canvasactions/tests/rounded.imagecache_preset.inc

@@ -1,9 +1,8 @@
 <?php
-// $ID:  $
 /**
  * @file
  *   Test imagecache preset.
- * 
+ *
  * Created on Dec 29, 2009
  *
  * @author 'dman' Dan Morrison http://coders.co.nz/
@@ -28,7 +27,8 @@ $presets['rounded'] = array (
       'name' => 'coloractions_convert',
       'data' =>array (
         'format' => 'image/png',
+        'quality' => '95',
       ),
     ),
   ),
-);
+);

+ 3 - 3
sites/all/modules/imagecache_actions/canvasactions/tests/rounded_bl.imagecache_preset.inc

@@ -1,9 +1,8 @@
 <?php
-// $ID:  $
 /**
  * @file
  *   Test imagecache preset.
- * 
+ *
  * Created on Dec 29, 2009
  *
  * @author 'dman' Dan Morrison http://coders.co.nz/
@@ -37,7 +36,8 @@ $presets['rounded_bl'] = array (
       'name' => 'coloractions_convert',
       'data' =>array (
         'format' => 'image/png',
+        'quality' => '95',
       ),
     ),
   ),
-);
+);

+ 0 - 1
sites/all/modules/imagecache_actions/canvasactions/tests/rounded_flattened.imagecache_preset.inc

@@ -1,5 +1,4 @@
 <?php
-// $ID:  $
 /**
  * @file
  *   Test imagecache preset.

+ 0 - 1
sites/all/modules/imagecache_actions/canvasactions/tests/watermark_100.imagecache_preset.inc

@@ -1,5 +1,4 @@
 <?php
-// $ID:  $
 /**
  * @file
  *   Test imagecache preset.

+ 0 - 1
sites/all/modules/imagecache_actions/canvasactions/tests/watermark_50.imagecache_preset.inc

@@ -1,5 +1,4 @@
 <?php
-// $ID:  $
 /**
  * @file
  *   Test imagecache preset.

+ 66 - 0
sites/all/modules/imagecache_actions/coloractions/imagecache_coloractions.htaccess_creator.inc

@@ -0,0 +1,66 @@
+<?php
+/**
+ * @file Functions to create .htaccess files in public://styles/{image-style}
+ * directories that force the correct Content-Type header.
+ */
+
+/**
+ * Checks for all image style if a .htaccess should be created to force a
+ * correct Content-Type header.
+ */
+function imagecache_coloractions_create_htaccess_all_styles() {
+  $styles = image_styles();
+  foreach ($styles as $style) {
+    imagecache_coloractions_create_htaccess_for_style($style);
+  }
+}
+
+/**
+ * Checks if an image style has a convert format image effect and if so, creates
+ * an .htaccess in the folder where the derivatives for this style are stored
+ * to force the correct Content-Type header.
+ *
+ * @param array $style
+ *
+ * @return bool|null
+ *   True if .htaccess created successfully, false om error, null if no
+ *  .htaccess needed to be created.
+ */
+function imagecache_coloractions_create_htaccess_for_style(array $style) {
+  // If we have multiple convert effects in the same style (I found one during
+  // testing) the last determines the mime type.
+  $format = NULL;
+  foreach ($style['effects'] as $effect) {
+    if ($effect['name'] === 'coloractions_convert') {
+      if (!empty($effect['data']['format'])) {
+        $format = $effect['data']['format'];
+      }
+    }
+  }
+  return $format ? imagecache_coloractions_create_htaccess($style['name'], $format) : NULL;
+}
+
+/**
+ * Creates an .htaccess file in the folder public://styles/%style_name.
+ *
+ * The folder itself will also be created if necessary.
+ *
+ * @param string $style_name
+ * @param string $mimeType
+ *
+ * @return bool
+ *   True on success, false otherwise.
+ */
+function imagecache_coloractions_create_htaccess($style_name, $mimeType) {
+  $forceType = "ForceType $mimeType\n";
+  $directory = "public://styles/$style_name";
+  if (!file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
+    watchdog('imagecache_actions', 'Failed to create style directory: %directory', array('%directory' => $directory), WATCHDOG_ERROR);
+    return FALSE;
+  }
+  if (!file_put_contents("$directory/.htaccess", $forceType)) {
+    watchdog('imagecache_actions', 'Failed to create .htaccess in style directory: %directory', array('%directory' => $directory), WATCHDOG_ERROR);
+    return FALSE;
+  }
+  return TRUE;
+}

+ 4 - 5
sites/all/modules/imagecache_actions/coloractions/imagecache_coloractions.info

@@ -1,19 +1,18 @@
 name = Imagecache Color Actions
-description = Additional ImageCache actions, providing color-shifting, brightness and alpha transparency effects.
+description = Provides image effects color-shifting, invert colors, brightness, posterize and alpha transparency effects. Also provides a change image format effect.
 package = Media
 core = 7.x
 
 dependencies[] = imagecache_actions
 dependencies[] = image
 
-files[] = imagecache_coloractions.install
 files[] = imagecache_coloractions.module
 files[] = transparency.inc
 files[] = tests/green.imagecache_preset.inc
 
-; Information added by drupal.org packaging script on 2012-12-04
-version = "7.x-1.1"
+; Information added by Drupal.org packaging script on 2018-03-20
+version = "7.x-1.9"
 core = "7.x"
 project = "imagecache_actions"
-datestamp = "1354653754"
+datestamp = "1521550387"
 

+ 8 - 23
sites/all/modules/imagecache_actions/coloractions/imagecache_coloractions.install

@@ -1,27 +1,12 @@
-<?php
+<?php
 
 /**
- * @file Set up new color actions. Tell imagecache.module about them
+ * Create an .htaccess file in image style directories that have a change format
+ * image effect to enforce the correct Content-Type header for the derivative
+ * images.
  */
-
-/**
- * Need to flush the cache when this module is enabled or disabled
- */
-function imagecache_coloractions_install() {
-  if (function_exists('imagecache_action_definitions') ) {
-    imagecache_action_definitions(TRUE);
-  }
-  cache_clear_all('imagecache_actions', 'cache');
-  drupal_set_message(t('Additional image style actions should now be available in the presets !settings_link', array('!settings_link' => l(t('settings'), 'admin/config/media/image-styles'))));
-}
-
-/**
- * @todo Please document this function.
- * @see http://drupal.org/node/1354
- */
-function imagecache_coloractions_uninstall() {
-  if (function_exists('imagecache_action_definitions') ) {
-    imagecache_action_definitions(TRUE);
-  }
-  cache_clear_all('imagecache_actions', 'cache');
+function imagecache_coloractions_update_7101(&$sandbox) {
+  module_load_include('module', 'image');
+  include_once dirname(__FILE__) . '/imagecache_coloractions.htaccess_creator.inc';
+  imagecache_coloractions_create_htaccess_all_styles();
 }

File diff suppressed because it is too large
+ 948 - 117
sites/all/modules/imagecache_actions/coloractions/imagecache_coloractions.module


+ 88 - 79
sites/all/modules/imagecache_actions/coloractions/transparency.inc

@@ -1,26 +1,26 @@
 <?php
 /**
- * @file Helper functions for the alpha action for imagecache
+ * @file Helper functions for the alpha effect.
  *
  * @author dan http://coders.co.nz
  */
 
-
 /**
- * Implementation of imagecache_hook_form()
+ * Image effect form callback for the alpha effect.
  *
- * Settings for alpha actions.
+ * @param array $data
+ *   The current configuration for this image effect.
  *
- * @param $action array of settings for this action
- * @return a form definition
+ * @return array
+ *   The form definition for this effect.
  */
-function imagecache_alpha_form($action) {
+function coloractions_alpha_form(array $data) {
   $defaults = array(
     'flatten' => FALSE,
     'RGB' => array('HEX' => '#000000'),
     'opacity' => 0.5,
   );
-  $action = array_merge($defaults, (array) $action);
+  $data = array_merge($defaults, (array) $data);
 
   $form = array();
   $form['help'] = array(
@@ -36,7 +36,7 @@ function imagecache_alpha_form($action) {
   $form['opacity'] = array(
     '#type' => 'textfield',
     '#title' => t('Opacity'),
-    '#default_value' => $action['opacity'],
+    '#default_value' => $data['opacity'],
     '#size' => 3,
     '#description' => t("
       A decimal between 0 and 1.
@@ -48,8 +48,9 @@ function imagecache_alpha_form($action) {
     "),
   );
 
-  $form['description'] = array('#value' => t(
-    "<p>Alpha toning is an advanced method of greyscaling or colorizing.
+  $form['description'] = array(
+    '#value' => t(
+      "<p>Alpha toning is an advanced method of greyscaling or colorizing.
       It works using transparency, not colour matching.
       The results of this filter are excellent for using as watermarks,
       and for 'sepia' type imprints on coloured or textured backgrounds.
@@ -58,9 +59,10 @@ function imagecache_alpha_form($action) {
       <em>unless</em> you either <strong>flatten</strong> this image against a background color
       or image in a later process or <strong>convert</strong> it to a PNG before saving
       using available imagecache actions.</p>"
-    ));
+    )
+  );
 
-  $form['RGB'] = imagecache_rgb_form($action['RGB']);
+  $form['RGB'] = imagecache_rgb_form($data['RGB']);
   $form['RGB']['#type'] = 'fieldset';
   $form['RGB']['#title'] = t('Fill Color');
   $form['RGB']['HEX']['#description'] = t("
@@ -70,114 +72,121 @@ function imagecache_alpha_form($action) {
     Set it to nothing to not perform any color shift.
     ");
 
-
   $form['flatten'] = array(
     '#type' => 'checkbox',
     '#title' => t('Flatten Transparency'),
-    '#default_value' => $action['flatten'],
+    '#default_value' => $data['flatten'],
     '#return_value' => TRUE,
     '#description' => t("The opposite of adding alpha transparency, 'flatten' will place the given colour solidly behind the image. Use this if you can't trust IE, or you really do want the image filled in with a solid colour."),
   );
+
   return $form;
 }
 
-
 /**
- * Implementation of theme_hook() for imagecache_ui.module
+ * Implements theme_hook() for the alpha effect summary.
+ *
+ * @param array $variables
+ *   An associative array containing:
+ *   - data: The current configuration for this image effect.
+ *
+ * @return string
+ *   The HTML for the summary of this image effect.
+ *
+ * @ingroup themeable
  */
-function theme_imagecache_alpha($variables) {
-  $element = $variables['element'];
-  return ($element['#value']['flatten'] ? t("Flatten") : t("Transparent"))
-    . ($element['#value']['opacity'] ? " : " . ($element['#value']['opacity'] * 100) . '%' : '')
-    . " : " . theme_imagecacheactions_rgb($element['#value']['RGB']);
+function theme_coloractions_alpha_summary(array $variables) {
+  $data = $variables['data'];
+  return ($data['flatten'] ? t("Flatten") : t("Transparent"))
+    . ($data['opacity'] ? " : " . ($data['opacity'] * 100) . '%' : '')
+    . " : " . theme_imagecacheactions_rgb($data['RGB']);
 }
 
-
 /**
- * Given an image, manipulate the transparancy behaviour.
- *
- * implementation of hook_image()
+ * Image effect callback for the alpha effect.
  *
  * Either convert light parts of an image to see-through, or place a solid
  * colour behind areas that would otherwise be see-though
  *
- * An imagecache_action_hook() . Handle a pipelined image transformation.
+ * To save a partially transparent image, the image resource must be switched to
+ * PNG. REMEMBER TO SWITCH IT BACK if needed.
  *
- * To save a partially transparent image, the image resource must be switched to PNG.
- * REMEMBER TO SWITCH IT BACK if needed
+ * @param stdClass $image
+ * @param array $data
  *
- * @param $image handle on the image definition, including a gd image resource
- * to act upon
- * @param $data settings for this process.
- * @return bool success
+ * @return bool
+ *   true on success, false otherwise.
  */
-function imagecache_alpha_image($image, $data = array()) {
-  if (! $data['flatten']) {
-    // given an image, convert dark areas to opaque,
-    // light to transparent,
+function coloractions_alpha_effect(stdClass $image, array $data) {
+  // @todo: Extract to GD specific function.
+  if (!$data['flatten']) {
+    // Given an image, convert dark areas to opaque, light to transparent.
     return png_color2alpha($image, $data['RGB']['HEX'], $data['opacity']);
   }
   else {
-    // Do the opposite, flatten the transparency ONTO the given colour
+    // Do the opposite, flatten the transparency ONTO the given color.
     $info = $image->info;
 
     if (!$info) {
-      watchdog("imagecache", "Problem converting image to fill behind. Source image returned no info");
-      #dsm($source);
-      return; // error
+      watchdog('imagecache_actions', "Problem converting image to fill behind. Source image returned no info");
+      return FALSE;
     }
 
     $base_image = imagecreatetruecolor($info['width'], $info['height']);
     imagesavealpha($base_image, TRUE);
     imagealphablending($base_image, FALSE);
 
-    // Start with a solid colour
+    // Start with a solid color.
     $background_rgb = imagecache_actions_hex2rgba($data['RGB']['HEX']);
 
-    // Setting the background colour here solid is what flattens the image
-    $background_color = @imagecolorallocatealpha($base_image, $background_rgb['red'], $background_rgb['green'], $background_rgb['blue'], 0);
-
-    // But what I really want to do is set it
-    // coloured rgb AND 100% transparent, in the hope that
-    // a failure to render transparency would instead render
+    // Setting the background color here solid is what flattens the image.
+    // But what I really want to do is set it colored rgb AND 100% transparent,
+    // in the hope that a failure to render transparency would instead render
     // THAT colour.
     $background_color = @imagecolorallocatealpha($base_image, $background_rgb['red'], $background_rgb['green'], $background_rgb['blue'], 0);
-    // But that still doesn't work.
-    // Yet somehow I've seen transparent images that fallback to white, not silver.
+    // But that still doesn't work. Yet somehow I've seen transparent images
+    // that fallback to white, not silver.
 
-    imagefill( $base_image, 0, 0, $background_color );
+    imagefill($base_image, 0, 0, $background_color);
 
-    // And set the overlay behaviour back again
+    // And set the overlay behavior back again.
     imagealphablending($base_image, TRUE);
 
-    // Place the current image over it
-    $foreground = $image->resource;
-    $success = imagecopy($base_image, $image->resource, 0, 0, 0, 0, $info['width'], $info['height']);
+    // Place the current image over it.
+    if ($result = imagecopy($base_image, $image->resource, 0, 0, 0, 0, $info['width'], $info['height'])) {
+      imagedestroy($image->resource);
+      $image->resource = $base_image;
+    }
 
-    $image->resource = $base_image;
-    return TRUE;
+    return $result;
   }
 }
 
 /**
- * This achives a tonal effect by converting the images combined tone and
+ * This achieves a tonal effect by converting the images combined tone and
  * existing transparency into one shade value. This is then used as the ALPHA
  * transparency for that pixel, while the whole thing is coloured the same
- * shade. Images 'greytoned' in this manner should sit smoothly on any
+ * shade. Images 'grey toned' in this manner should sit smoothly on any
  * background.
  *
  * With no color set, use the existing hue.
  *
- * To save a partially transparent image, the image resource must be switched to PNG.
- * ... or maybe not. Just flatten it yourself, or switch the format yourself.
- * This hack would produce side effects otherwise.
+ * To save a partially transparent image, the image resource must be switched to
+ * PNG. ... or maybe not. Just flatten it yourself, or switch the format
+ * yourself. This hack would produce side effects otherwise.
  *
  * This algorithm runs maths per-pixel, and therefore is incredibly much more
  * inefficient than any native routine. Will kill the server on large images.
- * 
- * @param $opacity between 0 transparent and 1 solid.
+ *
+ * @param stdClass $image
+ * @param string $color
+ * @param float $opacity
+ *   between 0 transparent and 1 solid.
+ *
+ * @return bool
+ *   true on success, false otherwise.
  */
-function png_color2alpha($image, $color, $opacity = NULL) {
+function png_color2alpha(stdClass $image, $color, $opacity = NULL) {
   $info = $image->info;
   if (!$info) {
     return FALSE;
@@ -195,11 +204,11 @@ function png_color2alpha($image, $color, $opacity = NULL) {
 
   if (($width * $height) > (1200 * 1200)) {
     watchdog('imagecache_actions', __FUNCTION__ . " on {$image->source}. Image is TOO BIG to run the per-pixel algorithm. Aborting.");
-    return TRUE;
+    return FALSE;
   }
   for ($i = 0; $i < $height; $i++) {
     //this loop traverses each row in the image
-    for ($j = 0; $j < $width; $j++) { 
+    for ($j = 0; $j < $width; $j++) {
       //this loop traverses each pixel of each row
       // Get the color & alpha info of the current pixel.
       $retrieved_color = imagecolorat($im1, $j, $i); // an index
@@ -207,33 +216,33 @@ function png_color2alpha($image, $color, $opacity = NULL) {
       $alpha = 127;
 
       // Calculate the total shade value of this pixel.
-      
-      // If the rule sets a color, then the darkness of the existing 
+
+      // If the rule sets a color, then the darkness of the existing
       // pixel will define the desired alpha value.
       if ($color) {
-        $lightness = ( $rgba_array['red'] + $rgba_array['green'] + $rgba_array['blue'] ) / 3;
+        $lightness = ($rgba_array['red'] + $rgba_array['green'] + $rgba_array['blue']) / 3;
         // Need to flip the numbers around before doing maths.
-        #$opacity = 1-($rgba_array['alpha']/127);
-        #$darkness = 1-($lightness/256); // 0 is white, 1 is black
-        #$visibility = $darkness * $opacity;
-        #$alpha = (1-$visibility) * 127;
-        $alpha = (1 - ((1 -($lightness / 256)) * (1 -($rgba_array['alpha'] / 127)))) * 127;
+        //$opacity = 1-($rgba_array['alpha']/127);
+        //$darkness = 1-($lightness/256); // 0 is white, 1 is black
+        //$visibility = $darkness * $opacity;
+        //$alpha = (1-$visibility) * 127;
+        $alpha = (1 - ((1 - ($lightness / 256)) * (1 - ($rgba_array['alpha'] / 127)))) * 127;
       }
-      // If color is NOT set, then the existing color is passed though, only 
+      // If color is NOT set, then the existing color is passed though, only
       // made somewhat transparent.
       if (!$color) {
         $background = $rgba_array;
       }
       if ($opacity) {
-        // It's a user-defined alpha value
+        // It's a user-defined alpha value.
         $alpha = $alpha * $opacity;
       }
-      
+
       // Paint the pixel.
+      /** @noinspection PhpUndefinedVariableInspection */
       $color_to_paint = imagecolorallocatealpha($image->resource, $background['red'], $background['green'], $background['blue'], $alpha);
       imagesetpixel($image->resource, $j, $i, $color_to_paint);
     }
   }
   return TRUE;
 }
-

+ 55 - 5
sites/all/modules/imagecache_actions/customactions/README.txt

@@ -21,9 +21,8 @@ Personally, I prefer the imagemagick toolkit:
   you will see what I mean.
 - It does not execute in the PHP memory space, so is not restricted by the
   memory_limit PHP setting.
-- The GD toolkit will, at least on my Windows configuration, keep the font file
+- The GD toolkit will, at least on my Windows configuration, keep font files
   open after a text operation, so you cannot delete, move or rename it anymore.
-- This module does a better job with Imagemagick (see below).
 
 
 Installing
@@ -59,10 +58,11 @@ record so by changing $image->info['width'] and/or $image->info['height'].
 General
 -------
 To ease your task, this effect makes some information regarding the image being
-processed available in 2 variables: $image and $image_context. These variables
-are readily available in your snippet.
+processed available in a number of variables: $image, $image_context,
+$image_style, and $image_effect_id. These variables are readily available in
+your snippet.
 
-$image is an associative array containing:
+$image is an object containing the following properties:
 - source: string, the source of the image, e.g. public://photo.jpg
 - info: array, example data:
    - width (int) 180
@@ -113,6 +113,18 @@ $image_context is an associative array containing:
    - title (string) ...
    - ...
 
+$image_style is an associative array containing the current image style being
+processed. It ocntians a.o.:
+- isid: the unique image style id
+- name: machine name.
+- label: Human readable name.
+- effects: An array with the effects of this image style, ordered in the way
+  they should be applied.
+
+$image_effect_id is an int containng the unique id of the current image effect
+being applied. This can be used to look the current image effect up in the
+$image_style array.
+
 Of course there are many other possible useful globals. Think of:
 - base_url
 - base_path
@@ -144,3 +156,41 @@ foreach ($referring_entities as $field_name => $field_referring_entities) {
   }
 }
 ?>
+
+"Dynamic" parameters
+--------------------
+Thee are many requests for adding token support or allowing for dynamic
+parameters in another way. However, the current image style processing does not
+easily allow for this. But for these cases we have the custom action to our
+rescue. It is quite easy to:
+- Create you own array of parameters.
+- Call the effect callback yourself
+
+Exanple, calling the watermark/canvas overlay effect:
+<?php
+$data = array(
+  'xpos' => 'center',
+  'ypos' => 'center',
+  'alpha' => '100',
+  'scale' => '',
+  'path' => 'module://imagecache_actions/tests/black-ribbon.gif',
+);
+return canvasactions_file2canvas_effect($image, $data);
+?>
+
+Or, to be on the safe side with effect info altering:
+<?php
+$definition = image_effect_definition_load('canvasactions_file2canvas');
+$callback = $definition['effect callback'];
+if (function_exists($callback)) {
+  $data = array(
+    'xpos' => 'center',
+    'ypos' => 'center',
+    'alpha' => '100',
+    'scale' => '',
+    'path' => 'module://imagecache_actions/tests/black-ribbon.gif',
+  );
+  return $callback($image, $data);
+}
+return FALSE;
+?>

+ 4 - 7
sites/all/modules/imagecache_actions/customactions/imagecache_customactions.info

@@ -1,17 +1,14 @@
 name = Imagecache Custom Actions
-description = Allow direct PHP code manipulation of imagecache images.
+description = Provides the custom and subroutine image effects.
 package = Media
 core = 7.x
 
 dependencies[] = imagecache_actions
 dependencies[] = image
 
-files[] = imagecache_customactions.install
-files[] = imagecache_customactions.module
-
-; Information added by drupal.org packaging script on 2012-12-04
-version = "7.x-1.1"
+; Information added by Drupal.org packaging script on 2018-03-20
+version = "7.x-1.9"
 core = "7.x"
 project = "imagecache_actions"
-datestamp = "1354653754"
+datestamp = "1521550387"
 

+ 2 - 2
sites/all/modules/imagecache_actions/customactions/imagecache_customactions.install

@@ -1,8 +1,8 @@
 <?php
 /**
- * Rename 'text' to 'php' in custom action effect data
+ * Rename 'text' to 'php' in custom action effect data.
  */
-function imagecache_customactions_update_7100(&$sandbox) {
+function imagecache_customactions_update_7100(/*&$sandbox*/) {
   $effects = db_select('image_effects')
     ->fields('image_effects')
     ->condition('name', 'imagecache_customactions', '=')

+ 135 - 109
sites/all/modules/imagecache_actions/customactions/imagecache_customactions.module

@@ -1,57 +1,82 @@
 <?php
 
 /**
- * @file Allow advanced users to code their own PHP image manipulation routines
- * as part of imagecache processing.
+ * @file Allows advanced users to code their own PHP image manipulation routines
+ * as part of image style processing.
  *
- * @author Originally contributed by crea http://drupal.org/node/325103#comment-
+ * @author Originally contributed by crea https://drupal.org/node/325103#comment-
  * 1076011
  *
  * @author merged into imagecache_actions by dman http://coders.co.nz
  *
- * Needs review - currently a security risk etc
+ * custom action effect:
+ * @todo: add description field that editors can use to define their own summary?
+ * @todo: add form field asking if dimensions stay the same (or if the new dimensions are known).
+ * subroutine effect:
+ * @todo: use isid to allow for image style renaming, but also use name to allow export and import (features)
  */
 
 
 /**
- * Implements hook_image_effect_info.
+ * Implements hook_image_effect_info().
  *
- * @return array
+ * Defines information about the supported effects.
  */
 function imagecache_customactions_image_effect_info() {
   $effects = array();
 
-  // @todo: implement summary theme callback
   $effects['imagecache_customactions'] = array(
     'label' => t('Custom action'),
     'help' => t('Runs custom PHP code.'),
-    'effect callback' => 'imagecache_customactions_image',
+    'effect callback' => 'imagecache_customactions_effect',
     'dimensions callback' => 'imagecache_customactions_dimensions',
     'form callback' => 'imagecache_customactions_form',
+    'summary theme' => 'imagecache_customactions_summary',
   );
 
   $effects['imagecache_subroutine'] = array(
     'label' => t('Subroutine'),
     'help' => t('Runs another defined preset on the image.'),
-    'effect callback' => 'imagecache_subroutine_image',
+    'effect callback' => 'imagecache_subroutine_effect',
     'dimensions callback' => 'imagecache_subroutine_dimensions',
     'form callback' => 'imagecache_subroutine_form',
+    'summary theme' => 'imagecache_subroutine_summary',
   );
 
   return $effects;
 }
 
 /**
- * Implements hook_image_style_flush.
+ * Implements hook_theme().
  *
- * This hook checks if the image style that is being flushed is used in an
- * subroutine effect. If so, the style that contains the subroutine effect,
- * should be flushed as well as the flushed style was probably changed.
+ * Registers theme functions for the effect summaries.
+ */
+function imagecache_customactions_theme() {
+  return array(
+    'imagecache_customactions_summary' => array(
+      'variables' => array('data' => NULL),
+    ),
+    'imagecache_subroutine_summary' => array(
+      'variables' => array('data' => NULL),
+    ),
+  );
+}
+
+/**
+ * Implements hook_image_style_flush().
+ *
+ * This hook checks if the image style that is being flushed is used in a
+ * subroutine effect. If so, the style that contains the subroutine effect
+ * should be flushed as well.
+ *
+ * This may lead to recursive calls to image_style_flush() and thus to this
+ * hook. Without loops in styles that call each other as subroutine, this
+ * recursion will always end.
  *
  * @param array $flushed_style
  *   The image style that is being flushed.
  */
-function imagecache_customactions_image_style_flush($flushed_style) {
+function imagecache_customactions_image_style_flush(/*array*/ $flushed_style) {
   $styles = image_styles();
   foreach ($styles as $style) {
     if ($style['name'] !== $flushed_style['name']) {
@@ -67,44 +92,34 @@ function imagecache_customactions_image_style_flush($flushed_style) {
 }
 
 /**
- * @deprecated replaced by summary theme callback
- * Implementation of theme_hook() for imagecache_customactions.module
- */
-function imagecache_customactions_theme() {
-  return array(
-    'imagecache_subroutine' => array(
-      'render element' => 'element',
-    ),
-  );
-}
-
-
-/**
- * Implements hook_form().
+ * Image effect form callback for the custom action effect.
+ *
+ * Note that this is not a complete form, it only contains the portion of the
+ * form for configuring the effect options. Therefore it does not not need to
+ * include metadata about the effect, nor a submit button.
  *
  * @param array $data
- *   Array of settings for this action.
+ *   The current configuration for this image effect.
+ *
  * @return array
- *   A form definition.
+ *   The form definition for this effect.
  */
-function imagecache_customactions_form($data) {
+function imagecache_customactions_form(array $data) {
   // Add defaults.
   $data += array('php' => 'return TRUE;');
 
   // Note: we also need to check for the existence of the module: admin has
   //   all rights, so user_acccess(...) returns TRUE even if the module is not
   //   enabled and the permission does not exist.
-  $allow_dynamic = user_access('use PHP for settings') && module_exists('php');
+  $allow_php = module_exists('php') && user_access('use PHP for settings');
 
-  // @todo: for imagemagick, the PHP code should add a set of commands to the
-  // ops aray of $image. Document this in description.
   $form = array(
     'php' => array(
       '#type' => 'textarea',
-      '#rows' => 10,
+      '#rows' => 12,
       '#title' => t('PHP code'),
       '#default_value' => $data['php'],
-      '#disabled' => !$allow_dynamic,
+      '#disabled' => !$allow_php,
       '#description' => t("<p>A piece of PHP code that modifies the image.
 It should return a boolean indicating success or failure.
 You will need the '%use_php' permission, defined by the 'PHP filter' module.
@@ -117,15 +132,30 @@ See the help for an extensive explanation of the possibilities.</p>",
 }
 
 /**
- * Implements hook_image().
+ * Implements theme_hook() for the custom action effect summary.
  *
- * @param object $image
+ * param array $variables
+ *   An associative array containing:
+ *   - data: The current configuration for this image effect.
+ *
+ * @return string
+ *   The HTML for the summary of this image effect.
+ * @ingroup themeable
+ */
+function theme_imagecache_customactions_summary(/*array $variables*/) {
+  return 'Custom PHP code';
+}
+
+/**
+ * Image effect callback for the custom action effect.
+ *
+ * @param stdClass $image
  * @param array $data
  *
- * @return bool
+ * @return boolean
+ *   true on success, false otherwise.
  */
-function imagecache_customactions_image($image, $data) {
-  // Check that the PHP filter module is enabled.
+function imagecache_customactions_effect(stdClass $image, array $data) {
   $result = module_exists('php');
   if ($result) {
     // Get context about the image.
@@ -133,10 +163,17 @@ function imagecache_customactions_image($image, $data) {
     $GLOBALS['image_context'] = imagecache_actions_get_image_context($image, $data);
     $GLOBALS['image'] = $image;
 
+    // Get (non-alterable) context about the image style and image effect.
+    $execution_info = imagecache_actions_get_image_effect_context();
+    $GLOBALS['image_style'] = $execution_info['image_style'];
+    $GLOBALS['image_effect_id'] = $execution_info['image_effect_id'];
+
     $result = php_eval('<' . '?php global $image, $image_context; ' . $data['php'] . ' ?' . '>');
     // php_eval returns '1' if the snippet returns true.
     $result = $result === '1';
 
+    unset($GLOBALS['image_effect_id']);
+    unset($GLOBALS['image_style']);
     unset($GLOBALS['image']);
     unset($GLOBALS['image_context']);
   }
@@ -150,94 +187,102 @@ function imagecache_customactions_image($image, $data) {
 }
 
 /**
- * Image dimensions callback; Custom action.
+ * Image dimensions callback for the custom action effect.
  *
  * @param array $dimensions
- *   Dimensions to be modified - an array with components width and height, in
- *   pixels.
- * @param array $data
- *   An array with the effect options.
+ *   Dimensions to be modified - an associative array containing the items
+ *   'width' and 'height' (in pixels).
+ * param array $data
+ *   An associative array containing the effect data.
  */
-function imagecache_customactions_dimensions(array &$dimensions, array $data) {
-  // @todo: add form field asking if dimensions stay the same (or if they know
-  // the new dimesions).
+function imagecache_customactions_dimensions(array &$dimensions/*, array $data*/) {
   $dimensions['width'] = NULL;
   $dimensions['height'] = NULL;
 }
 
 /**
- * @todo change into summary theme callback
- * Implementation of theme_hook() for imagecache_ui.module
- */
-function theme_imagecache_customactions($element) {
-  // TODO: Should this theme imagecache_customactions be declared in hook_theme()?
-  $data = $element['#value'];
-  return "<em><strong>" . $data['text'] . "</strong></em>";
-}
-
-/**
  * Subroutine - an imagecache action that just calls another one.
  *
  * Contributed by Alan D
- * http://drupal.org/node/618784
+ * https://drupal.org/node/618784
  *
  * Reworked into customactions by dman 2010-07
  */
 
 /**
- * Config form for this preset.
- *
- * Implementation of imagecache_hook_form()
+ * Image effect form callback for the subroutine effect.
  *
  * @param array $data
- *   The effect data for this effect.
+ *   The current configuration for this image effect.
+ *
  * @return array
- *   The form definition.
+ *   The form definition for this effect.
  */
-function imagecache_subroutine_form($data) {
-  $data = (array) $data;
-  $form = array();
+function imagecache_subroutine_form(array $data) {
+  // Add defaults.
+  $data += array('subroutine_presetname' => '');
 
-  // List available presets
-  // @todo: use image_style_options and remove current style?
-  $presets = array();
-  foreach (image_styles(TRUE) as $preset) {
-    $presets[$preset['name']] = $preset['name'];
-  }
+  // List available image styles.
+  // The PASS_THROUGH parameter is new as of D7.23, and is added here to prevent
+  // image_style_options() from double-encoding the human-readable image style
+  // name, since the form API will already sanitize options in a select list.
+  $styles = image_style_options(TRUE, PASS_THROUGH);
+  //@todo: unset the current style to prevent obvious recursion.
+
+  $form = array();
 
   $form['subroutine_presetname'] = array(
     '#type' => 'select',
-    '#title' => t('Preset to call'),
+    '#title' => t('Image style to call'),
     '#default_value' => $data['subroutine_presetname'],
-    '#options' => $presets,
+    '#options' => $styles,
+    '#required' => TRUE,
   );
 
   return $form;
 }
 
-
 /**
- * Actually invoke the action - which means just handing off to the named real
- * preset to do the job.
+ * Implements theme_hook() for the subroutine effect summary.
+ *
+ * @param array $variables
+ *   An associative array containing:
+ *   - data: The current configuration for this image effect.
  *
- * Implementation of hook_image()
+ * @return string
+ *   The HTML for the summary of this image effect.
+ * @ingroup themeable
+ */
+function theme_imagecache_subroutine_summary(array $variables) {
+  $data = $variables['data'];
+
+  module_load_include('inc', 'imagecache_actions', 'utility');
+  $label = imagecache_actions_get_style_label($data['subroutine_presetname']);
+  return t('Apply image style %label', array('%label' => $label));
+}
+
+/**
+ * Image effect callback for the subroutine effect.
  *
- * @param object $image
+ * @param stdClass $image
  * @param array $data
  *
- * @return bool
+ * @return boolean
+ *   true on success, false otherwise.
  */
-function imagecache_subroutine_image($image, $data) {
-  if ($preset = image_style_load($data['subroutine_presetname'])) {
-    foreach ($preset['effects'] as $effect) {
-      image_effect_apply($image, $effect);
+function imagecache_subroutine_effect(stdClass $image, array $data) {
+  $result = FALSE;
+  if ($style = image_style_load($data['subroutine_presetname'])) {
+    $result = TRUE;
+    foreach ($style['effects'] as $effect) {
+      $result = $result && image_effect_apply($image, $effect);
     }
   }
-  return TRUE;
+  return $result;
 }
 
 /**
- * Image dimensions callback; Subroutine.
+ * Image dimensions callback for the subroutine effect.
  *
  * @param array $dimensions
  *   Dimensions to be modified - an array with components width and height, in
@@ -246,25 +291,6 @@ function imagecache_subroutine_image($image, $data) {
  *   An array with the effect options.
  */
 function imagecache_subroutine_dimensions(array &$dimensions, array $data) {
-  // @todo: dimensions
-  // @todo: call dimensions callback on subroutine style.
-  $dimensions['width'] = NULL;
-  $dimensions['height'] = NULL;
-}
-
-/**
- * @todo change into summary theme callback
- * This lets the user see what parameters were selected for the action
- */
-function theme_imagecache_subroutine($variables) {
-  // @todo: better decsription, do not use internal id's, imagecache_preset_by_name does not exist: fatal error?
-  $element = $variables['element'];
-  $data = $element['#value'];
-  if ($preset = imagecache_preset_by_name($data['subroutine_presetname'])) {
-    return t('%name (pid: !presetid)', array(
-      '%name' => $preset['presetname'],
-      '!presetid' => $preset['presetid']
-    ));
-  }
-  return t('<span class="error">Invalid reference. The referenced preset may have been deleted!</span>');
+  // Let the subroutine transform the dimensions.
+  image_style_transform_dimensions($data['subroutine_presetname'], $dimensions);
 }

File diff suppressed because it is too large
+ 36 - 0
sites/all/modules/imagecache_actions/image_effects_text/Apostrophic Labs License Komika).txt


BIN
sites/all/modules/imagecache_actions/image_effects_text/Blokletters-Balpen.ttf


BIN
sites/all/modules/imagecache_actions/image_effects_text/Blokletters-Potlood.ttf


BIN
sites/all/modules/imagecache_actions/image_effects_text/Blokletters-Viltstift.ttf


+ 24 - 0
sites/all/modules/imagecache_actions/image_effects_text/Creative Commons Attribution Share 2.5 (Blokletters).txt

@@ -0,0 +1,24 @@
+Blokletters fonts by Lefly Fonts: http://lefly.vepar.nl/ under the following
+license:
+
+You are free:
+
+to Share — to copy, distribute and transmit the work
+to Remix — to adapt the work
+
+Under the following conditions:
+
+Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
+
+Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
+
+With the understanding that:
+
+Waiver — Any of the above conditions can be waived if you get permission from the copyright holder.
+
+Other Rights — In no way are any of the following rights affected by the license:
+- Your fair dealing or fair use rights;
+- The author's moral rights;
+- Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights.
+
+Notice — For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page.

BIN
sites/all/modules/imagecache_actions/image_effects_text/Komika_display.ttf


+ 93 - 0
sites/all/modules/imagecache_actions/image_effects_text/OFL (Pacifico).txt

@@ -0,0 +1,93 @@
+Copyright (c) 2011, Vernon Adams (vern@newtypography.co.uk),
+with Reserved Font Name Pacifico.
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded, 
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright