Ignore:
Timestamp:
Feb 16, 2010, 11:32:20 PM (14 years ago)
Author:
plg
Message:

feature 1409 added: new tab "Settings".

Note: I would have like to use jQuery UI sliders for resize dimensions and
image quality BUT I can't even find the documentation of the very old version
of jQuery UI we use. I'll implement theses widget when integrating UploadForm
into trunk (with jQuery + jQuery UI updated).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/upload_form/include/functions_upload.inc.php

    r4875 r4897  
    1818// 4) register in database
    1919
    20 $page['max_width'] = 800;
    21 $page['max_height'] = 800;
    22 
    23 $page['thumb_width'] = 128;
    24 $page['thumb_height'] = 96;
    25 
    26 $page['source_file'] = '/home/pierrick/public_html/test/resize/phpthumb/examples/statue_small.jpg';
    27 
    2820function add_uploaded_file($source_filepath, $original_filename=null, $categories=null, $level=null)
    2921{
    30   global $page;
     22  global $conf;
    3123
    3224  // current date
     
    5951  }
    6052
    61   if (need_resize($file_path, $page['max_width'], $page['max_height']))
     53  if ($conf['upload_form_websize_resize']
     54      and need_resize($file_path, $conf['upload_form_websize_maxwidth'], $conf['upload_form_websize_maxheight']))
    6255  {
    6356    $high_path = file_path_for_type($file_path, 'high');
     
    6861    $high_infos = pwg_image_infos($high_path);
    6962   
    70     pwg_image_resize($high_path, $file_path, $page['max_width'], $page['max_height']);
     63    pwg_image_resize(
     64      $high_path,
     65      $file_path,
     66      $conf['upload_form_websize_maxwidth'],
     67      $conf['upload_form_websize_maxheight'],
     68      $conf['upload_form_websize_quality']
     69      );
    7170  }
    7271
     
    7675  $thumb_dir = dirname($thumb_path);
    7776  prepare_directory($thumb_dir);
    78   pwg_image_resize($file_path, $thumb_path, $page['thumb_width'], $page['thumb_height']);
     77 
     78  pwg_image_resize(
     79    $file_path,
     80    $thumb_path,
     81    $conf['upload_form_thumb_maxwidth'],
     82    $conf['upload_form_thumb_maxheight'],
     83    $conf['upload_form_thumb_quality']
     84    );
     85 
    7986  $thumb_infos = pwg_image_infos($thumb_path);
    8087
     
    163170}
    164171
    165 function pwg_image_resize($source_filepath, $destination_filepath, $max_width, $max_height)
     172function pwg_image_resize($source_filepath, $destination_filepath, $max_width, $max_height, $quality)
    166173{
    167174  if (!function_exists('gd_info'))
     
    230237    );
    231238 
    232   imagejpeg($destination_image, $destination_filepath, 95);
     239  imagejpeg($destination_image, $destination_filepath, $quality);
    233240  // freeing memory ressources
    234241  imagedestroy($source_image);
Note: See TracChangeset for help on using the changeset viewer.