/[drupal]/contributions/modules/imagecache_actions/imagecache_canvasactions.module
ViewVC logotype

Diff of /contributions/modules/imagecache_actions/imagecache_canvasactions.module

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

revision 1.3.2.14, Mon Aug 31 04:12:20 2009 UTC revision 1.3.2.15, Fri Oct 30 13:57:47 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: imagecache_canvasactions.module,v 1.3.2.13 2009/08/31 02:35:13 dman Exp $  // $Id: imagecache_canvasactions.module,v 1.3.2.14 2009/08/31 04:12:20 dman Exp $
3    
4  /**  /**
5   * @file A collection of canvas (layer) type manipulations for imagecache -   * @file A collection of canvas (layer) type manipulations for imagecache -
# Line 61  function imagecache_canvasactions_imagec Line 61  function imagecache_canvasactions_imagec
61        'file' => 'canvasactions.inc',        'file' => 'canvasactions.inc',
62      ),      ),
63      'canvasactions_file2canvas' => array(      'canvasactions_file2canvas' => array(
64        'name' => t('Overlay: file image to canvas (watermark)'),        'name' => t('Overlay (watermark)'),
65        'description' => t(' Choose the file image you wish to use as an overlay, and position it in a layer on top of the canvas.'),        'description' => t(' Choose the file image you wish to use as an overlay, and position it in a layer on top of the canvas.'),
66        'file' => 'canvasactions.inc',        'file' => 'canvasactions.inc',
67      ),      ),
68      'canvasactions_canvas2file' => array(      'canvasactions_canvas2file' => array(
69        'name' => t('Underlay: place a file image under the current image (background)'),        'name' => t('Underlay (background)'),
70        'description' => t(' Choose the file image you wish to use as an background, and position the processed image on it.'),        'description' => t(' Choose the file image you wish to use as an background, and position the processed image on it.'),
71        'file' => 'canvasactions.inc',        'file' => 'canvasactions.inc',
72      ),      ),
73      'canvasactions_source2canvas' => array(      'canvasactions_source2canvas' => array(
74       'name' => t('Overlay: source image to canvas'),       'name' => t('Overlay: source image to canvas'),
75       'description' => t('Places the source image onto the canvas for compositing.'),       'description' => t('Places the source image onto the canvas for compositing.'),
76       'file' => 'canvasactions.inc',       'file' => 'canvasactions.inc',
77      ),      ),
78      'canvasactions_roundedcorners' => array(      'canvasactions_roundedcorners' => array(
79        'name' => t('Rounded Corners: Set a radius to crop corners by.'),        'name' => t('Rounded Corners'),
80        'description' => t(' This is true cropping, not overlays, so the result <em>can</em> be transparent.'),        'description' => t(' This is true cropping, not overlays, so the result <em>can</em> be transparent.'),
81        'file' => 'canvasactions.inc',        'file' => 'canvasactions.inc',
82      ),      ),
83      'canvasactions_aspect' => array(      'canvasactions_aspect' => array(
84        'name' => t('Aspect switcher: '),        'name' => t('Aspect switcher: Switch between portrait and landscape.'),
85        'description' => 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.'),        'description' => 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.'),
86        'file' => 'canvasactions.inc',        'file' => 'canvasactions.inc',
87      ),      ),
# Line 180  function imageapi_gd_image_overlay(&$ima Line 180  function imageapi_gd_image_overlay(&$ima
180      imagesavealpha($layer->resource, TRUE);      imagesavealpha($layer->resource, TRUE);
181      imagecopy($image->resource, $layer->resource, $x, $y, 0, 0, $layer->info['width'], $layer->info['height']);      imagecopy($image->resource, $layer->resource, $x, $y, 0, 0, $layer->info['width'], $layer->info['height']);
182      imagedestroy($layer->resource);      imagedestroy($layer->resource);
183        #imagealphablending($image->resource, FALSE);
184    }    }
185    else {    else {
186      // else imagecopymerge fails and we have to use the slow library      // else imagecopymerge fails and we have to use the slow library
# Line 193  function imageapi_gd_image_overlay(&$ima Line 194  function imageapi_gd_image_overlay(&$ima
194      // When doing underlay, It's the second image object that we really care about.      // When doing underlay, It's the second image object that we really care about.
195      // Update that with the result      // Update that with the result
196      $layer->resource = $image->resource;      $layer->resource = $image->resource;
197        $layer->info = $image->info;
198    }    }
   
199    return TRUE;    return TRUE;
200  }  }
201    
# Line 214  function imageapi_imagemagick_image_over Line 215  function imageapi_imagemagick_image_over
215    // Bloody libraries - I tried  [6.2.8 06/11/08] because thats what I could get for my distro.    // Bloody libraries - I tried  [6.2.8 06/11/08] because thats what I could get for my distro.
216    
217    # This just drops the image on, no alpha:    # This just drops the image on, no alpha:
218    $image->ops[] = "  \"$layer_filepath\" -geometry +$x+$y  -composite    "  ;    if ($alpha == 100) {
219        $image->ops[] = "  \"$layer_filepath\" -geometry +$x+$y  -composite    "  ;
220      }
221      else {
222        $compose_arg = "  ";
223        # $compose_arg = " -compose dissolve ";
224        // -compose disolve is supposed to work, but doesn't in available imagemagick versions
225        $geometry_arg = " -geometry +$x+$y ";
226        $alpha_arg = " -set \"option:compose:args\" $alpha ";
227        $image->ops[] = "  \"$layer_filepath\" $compose_arg $geometry_arg $alpha_arg  -composite ";
228    
229      }
230      #  watchdog('imagecache_canvas', print_r($image->ops, 1) );
231    # This also worked    # This also worked
232    #  $image->ops[] = ' -draw "image over {$x},{$y} 0,0 \'{$layer_filepath}\'"'  ;    #  $image->ops[] = ' -draw "image over {$x},{$y} 0,0 \'{$layer_filepath}\'"'  ;
233    

Legend:
Removed from v.1.3.2.14  
changed lines
  Added in v.1.3.2.15

  ViewVC Help
Powered by ViewVC 1.1.2