updated i18n i10n_update workflwo imachecache_actions

This commit is contained in:
2020-06-23 12:41:21 +02:00
parent 8c39ab6f4a
commit 092758ecb0
134 changed files with 2894 additions and 1205 deletions
@@ -58,8 +58,9 @@ 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 object containing the following properties:
- source: string, the source of the image, e.g. public://photo.jpg
@@ -112,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
@@ -143,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;
?>
@@ -6,9 +6,8 @@ core = 7.x
dependencies[] = imagecache_actions
dependencies[] = image
; Information added by Drupal.org packaging script on 2016-02-19
version = "7.x-1.7"
; Information added by Drupal.org packaging script on 2020-06-16
version = "7.x-1.12"
core = "7.x"
project = "imagecache_actions"
datestamp = "1455872655"
datestamp = "1592294437"
@@ -156,7 +156,6 @@ function theme_imagecache_customactions_summary(/*array $variables*/) {
* true on success, false otherwise.
*/
function imagecache_customactions_effect(stdClass $image, array $data) {
// Check that the PHP filter module is enabled.
$result = module_exists('php');
if ($result) {
// Get context about the image.
@@ -164,10 +163,17 @@ function imagecache_customactions_effect(stdClass $image, array $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']);
}