~ubuntu-fr/ubuntu-fr-website/www.dev

« back to all changes in this revision

Viewing changes to sites/all/modules/imageapi/imageapi_gd.module

  • Committer: Vincent Liefooghe
  • Date: 2010-11-16 20:51:54 UTC
  • Revision ID: vl@ubuntovo-20101116205154-fuyfka524rm2zgni
Mise à jour des modules Backup & Migrate, Image API, Token et Pathauto

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php // $Id: imageapi_gd.module,v 1.13.2.7 2009/04/17 00:15:21 drewish Exp $
 
1
<?php // $Id: imageapi_gd.module,v 1.13.2.9 2010/10/17 18:16:13 drewish Exp $
2
2
 
3
3
/**
4
4
 * @file
46
46
 
47
47
/**
48
48
 * Save an image file to a destination.
49
 
 * 
 
49
 *
50
50
 * @param $image
51
51
 *   An image object.
52
52
 * @param $destination
200
200
  $image->info['width'] = imagesx($image->resource);
201
201
  $image->info['height'] = imagesy($image->resource);
202
202
  return TRUE;
203
 
 
203
}
204
204
 
205
205
function imageapi_gd_image_sharpen(&$image, $radius, $sigma, $amount, $threshold) {
206
206
  $threshold = round($threshold * 255);
246
246
    // Grab transparent color index from image resource.
247
247
    $transparent = imagecolortransparent($image->resource);
248
248
 
249
 
    if ($transparent >= 0) {
 
249
    if ($transparent >= 0 && $transparent < imagecolorstotal($image->resource)) {
250
250
      // The original must have a transparent color, allocate to the new image.
251
251
      $transparent_color = imagecolorsforindex($image->resource, $transparent);
252
252
      $transparent = imagecolorallocate($res, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']);
276
276
 */
277
277
function imageapi_gd_unsharp_mask($img, $radius, $sigma, $amount, $threshold)    {
278
278
 
279
 
  ////////////////////////////////////////////////////////////// 
280
 
  ////   
281
 
  ////                  Unsharp Mask for PHP - version 2.1.1   
282
 
  ////   
283
 
  ////    Unsharp mask algorithm by Torstein H�nsi 2003-07.   
284
 
  ////             thoensi_at_netcom_dot_no.   
285
 
  ////               Please leave this notice.   
286
 
  ////   
287
 
  //////////////////////////////////////////////////////////////
288
 
  
 
279
  //////////////////////////////////////////////////////////////
 
280
  ////
 
281
  ////                  Unsharp Mask for PHP - version 2.1.1
 
282
  ////
 
283
  ////    Unsharp mask algorithm by Torstein H�nsi 2003-07.
 
284
  ////             thoensi_at_netcom_dot_no.
 
285
  ////               Please leave this notice.
 
286
  ////
 
287
  //////////////////////////////////////////////////////////////
 
288
 
289
289
  // http://vikjavev.no/computing/ump.php
290
290
 
291
291
  // $img is an image that is already created within php using
309
309
  $img_blur = imagecreatetruecolor($w, $h);
310
310
 
311
311
  // Gaussian blur matrix:
312
 
  //                          
313
 
  //    1    2    1          
314
 
  //    2    4    2          
315
 
  //    1    2    1          
316
 
  //                          
317
 
  //////////////////////////////////////////////////  
 
312
  //
 
313
  //    1    2    1
 
314
  //    2    4    2
 
315
  //    1    2    1
 
316
  //
 
317
  //////////////////////////////////////////////////
318
318
 
319
319
  $matrix = array(
320
320
    array( 1, 2, 1 ),
321
321
    array( 2, 4, 2 ),
322
 
    array( 1, 2, 1 ) 
 
322
    array( 1, 2, 1 )
323
323
    );
324
324
 
325
325
  imagecopy($img_blur, $img, 0, 0, 0, 0, $w, $h);