/[drupal]/contributions/modules/imagecrop/imagecache.patch
ViewVC logotype

Contents of /contributions/modules/imagecrop/imagecache.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Mon Mar 24 16:29:28 2008 UTC (20 months ago) by swentel
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-5
File MIME type: text/x-patch
Initial import of imagecrop. This module provides an extra imagecache action called javascript_crop and hooks into modules or fields to manipulate images with a javascript toolbox
1 --- imagecache.module.orig 2008-03-08 12:07:03.000000000 +0100
2 +++ imagecache.module 2008-03-08 12:21:24.000000000 +0100
3 @@ -320,7 +320,7 @@
4
5 // check if deriv exists... (file was created between apaches request handler and reaching this code)
6 // otherwise try to create the derivative.
7 - if (!file_exists($dst) && !imagecache_build_derivative($preset['actions'], $src, $dst)) {
8 + if (!file_exists($dst) && !imagecache_build_derivative($preset, $src, $dst)) {
9 // Generate an error if image could not generate.
10 watchdog('imagecache', t('Failed generating an image from %image using imagecache preset %preset.', array('%image' => $path, '%preset' => $preset)), WATCHDOG_ERROR);
11 header("HTTP/1.0 500 Internal Server Error");
12 @@ -333,7 +333,7 @@
13 $actions = imagecache_action_definitions();
14
15 if ($definition = imagecache_action_definition($action['action'])) {
16 - return call_user_func($action['action'] .'_image', $image, $action['data']);
17 + return call_user_func($action['action'] .'_image', $image, $action['data'], $action['presetid']);
18 }
19 // skip undefined actions.. module probably got uninstalled or disabled.
20 watchdog('imagecache', t('non-existant action %action', array('%action' => $action['action'])), WATCHDOG_NOTICE);
21 @@ -436,7 +436,7 @@
22 * @param $tmp Path of the temporary file used for manipulating the image.
23 * @return TRUE - derivative generated, FALSE - no derivative generated, NULL - derivative being generated
24 */
25 -function imagecache_build_derivative($actions, $src, $dst) {
26 +function imagecache_build_derivative($preset, $src, $dst) {
27 // get the folder for the final location of this preset...
28 $dir = dirname($dst);
29
30 @@ -450,8 +450,7 @@
31 return FALSE;
32 }
33
34 -
35 - foreach ($actions as $action) {
36 + foreach ($preset['actions'] as $action) {
37 if (!empty($action['data'])) {
38 // QuickSketch, why do these run first/twice? - dopry.
39 if (isset($action['data']['width'])) {
40 @@ -464,6 +463,8 @@
41 $action['data'][$key] = _imagecache_filter($key, $value, $image->info['width'], $image->info['height'], $width, $height);
42 }
43 }
44 + // add preset id
45 + $action['presetid'] = $preset['presetid'];
46 if (!_imagecache_apply_action($action, $image)) {
47 watchdog( 'imagecache', t('action(id:%id): %action failed for %src', array('%id' => $action['actionid'], '%action' => $action['action'], '%src' => $src)), WATCHDOG_ERROR);
48 return FALSE;

  ViewVC Help
Powered by ViewVC 1.1.2