added missing module fixer and updated imagecache_actions

This commit is contained in:
Bachir Soussi Chiadmi
2018-03-21 17:06:08 +01:00
parent 3f7e130321
commit 0bcc558ed5
83 changed files with 6386 additions and 2517 deletions

View File

@@ -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"

View File

@@ -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');
}

View File

@@ -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(
'file' => 'canvasactions.inc',
'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']) {

View File

@@ -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.

View File

@@ -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',
),
),
),
);
);

View File

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

View File

@@ -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',
),
),
),
);
);

View File

@@ -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',
),
),
),
);
);

View File

@@ -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',
),
),
),
);
);

View File

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

View File

@@ -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',
),
),
),
);
);

View File

@@ -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',
),
),
),
);
);

View File

@@ -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',
),
),
),
);
);

View File

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

View File

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

View File

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