Ignore:
Timestamp:
02/16/10 23:32:20 (10 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).

Location:
extensions/upload_form
Files:
4 added
6 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); 
  • extensions/upload_form/language/en_UK/plugin.lang.php

    r4895 r4897  
    4242$lang['... or switch to the old style form'] = '... or switch to the old style form'; 
    4343$lang['... or switch to the multiple files form'] = '... or switch to the multiple files form'; 
     44 
     45$lang['The websize maximum width must be a number between %d and %d'] = 'The websize maximum width must be a number between %d and %d'; 
     46$lang['The websize maximum height must be a number between %d and %d'] = 'The websize maximum height must be a number between %d and %d'; 
     47$lang['The websize image quality must be a number between %d and %d'] = 'The websize image quality must be a number between %d and %d'; 
     48$lang['The thumbnail maximum width must be a number between %d and %d'] = 'The thumbnail maximum width must be a number between %d and %d'; 
     49$lang['The thumbnail maximum height must be a number between %d and %d'] = 'The thumbnail maximum height must be a number between %d and %d'; 
     50$lang['The thumbnail image quality must be a number between %d and %d'] = 'The thumbnail image quality must be a number between %d and %d'; 
     51$lang['Settings'] = 'Settings'; 
     52$lang['Web size photo'] = 'Web size photo'; 
     53$lang['Resize'] = 'Resize'; 
     54$lang['Maximum Width'] = 'Maximum Width'; 
     55$lang['pixels'] = 'pixels'; 
     56$lang['Maximum Height'] = 'Maximum Height'; 
     57$lang['Image Quality'] = 'Image Quality'; 
     58$lang['Thumbnail'] = 'Thumbnail'; 
     59$lang['Save Settings'] = 'Save Settings'; 
     60$lang['Your configuration settings are saved'] = 'Your configuration settings are saved'; 
  • extensions/upload_form/language/fr_FR/plugin.lang.php

    r4895 r4897  
    4242$lang['... or switch to the old style form'] = '... ou passer sur le formulaire "à l\'ancienne"'; 
    4343$lang['... or switch to the multiple files form'] = '... ou passer sur le formulaire multi-fichier'; 
     44 
     45$lang['The websize maximum width must be a number between %d and %d'] = 'La largeur maximum pour la photo taille web doit être un chiffre compris entre %d et %d'; 
     46$lang['The websize maximum height must be a number between %d and %d'] = 'La hauteur maximum pour la photo taille web doit être un chiffre compris entre %d et %d'; 
     47$lang['The websize image quality must be a number between %d and %d'] = 'La qualité d\'image pour la photo taille web doit être un chiffre compris entre %d et %d'; 
     48$lang['The thumbnail maximum width must be a number between %d and %d'] = 'La largeur maximum pour la miniature doit être un chiffre compris entre %d et %d'; 
     49$lang['The thumbnail maximum height must be a number between %d and %d'] = 'La hauteur maximum pour la miniature doit être un chiffre compris entre %d et %d'; 
     50$lang['The thumbnail image quality must be a number between %d and %d'] = 'La qualité d\'image pour la miniature doit être un chiffre compris entre %d et %d'; 
     51 
     52$lang['Settings'] = 'Configuration'; 
     53$lang['Web size photo'] = 'Photo taille web'; 
     54$lang['Resize'] = 'Redimensionner'; 
     55$lang['Maximum Width'] = 'Largeur maximum'; 
     56$lang['pixels'] = 'pixels'; 
     57$lang['Maximum Height'] = 'Hauteur maximum'; 
     58$lang['Image Quality'] = 'Qualité d\'image'; 
     59$lang['Thumbnail'] = 'Miniature'; 
     60$lang['Save Settings'] = 'Enregistrer les paramètres'; 
     61$lang['Your configuration settings are saved'] = 'Vos paramètres de configurations sont enregistrés'; 
  • extensions/upload_form/main.inc.php

    r4739 r4897  
    2525    array( 
    2626      'NAME' => 'Upload Form', 
    27       'URL'  => get_admin_plugin_menu_link(dirname(__FILE__).'/upload.php') 
     27      'URL'  => get_admin_plugin_menu_link(dirname(__FILE__).'/base.php') 
    2828      ) 
    2929    ); 
  • extensions/upload_form/upload.php

    r4895 r4897  
    2020// +-----------------------------------------------------------------------+ 
    2121 
    22 if( !defined("PHPWG_ROOT_PATH") ) 
     22if (!defined('UPLOAD_FORM_BASE_URL')) 
    2323{ 
    2424  die ("Hacking attempt!"); 
    2525} 
    26  
    27 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 
    28 include_once(UPLOAD_FORM_PATH.'include/functions_upload.inc.php'); 
    29 load_language('plugin.lang', UPLOAD_FORM_PATH); 
    30  
    31 $admin_base_url = get_root_url().'admin.php?page=plugin&section=upload_form%2Fupload.php'; 
    32  
    33 // +-----------------------------------------------------------------------+ 
    34 // | Check Access and exit when user status is not ok                      | 
    35 // +-----------------------------------------------------------------------+ 
    36 check_status(ACCESS_ADMINISTRATOR); 
    3726 
    3827// +-----------------------------------------------------------------------+ 
     
    323312    } 
    324313 
    325     $page['batch_link'] = $admin_base_url.'&batch='.implode(',', $image_ids); 
     314    $page['batch_link'] = UPLOAD_FORM_BASE_URL.'&batch='.implode(',', $image_ids); 
    326315  } 
    327316} 
     
    330319// |                             template init                             | 
    331320// +-----------------------------------------------------------------------+ 
    332  
    333 $template->set_filenames( 
    334   array( 
    335     'plugin_admin_content' => dirname(__FILE__).'/upload.tpl' 
    336     ) 
    337   ); 
    338321 
    339322$template->assign( 
    340323    array( 
    341       'F_ADD_ACTION'=> $admin_base_url, 
     324      'F_ADD_ACTION'=> UPLOAD_FORM_BASE_URL, 
    342325      'plugin_path' => UPLOAD_FORM_PATH, 
    343326    ) 
     
    360343    array( 
    361344      'upload_mode' => $upload_mode, 
    362       'switch_url' => $admin_base_url.'&upload_mode='.$upload_switch, 
     345      'switch_url' => UPLOAD_FORM_BASE_URL.'&upload_mode='.$upload_switch, 
    363346      'upload_id' => md5(rand()), 
    364347      'session_id' => session_id(), 
  • extensions/upload_form/upload.tpl

    r4895 r4897  
    5656{/if} 
    5757 
    58 {literal} 
    59 <style> 
    60 #uploadBoxes P { 
    61   margin:0; 
    62   margin-bottom:2px; 
    63   padding:0; 
    64 } 
    65  
    66 #batchLink { 
    67   text-align:center; 
    68 } 
    69  
    70 .category_selection { 
    71   min-height:65px; 
    72   margin-top:5px; 
    73 } 
    74  
    75 .category_selection TABLE { 
    76   margin:0; 
    77 } 
    78  
    79 .formField { 
    80   width:650px; 
    81   margin:0 auto 20px auto; 
    82   padding:10px; 
    83   border: 2px solid #292929; 
    84 } 
    85  
    86 .formFieldTitle { 
    87   font-weight:bold; 
    88   margin-bottom:10px; 
    89 } 
    90  
    91 .formField P { 
    92   margin:0; 
    93 } 
    94 </style> 
    95 {/literal} 
    96  
    97 <div class="titrePage" style="height:0"> 
     58<div class="titrePage" style="height:25px"> 
    9859  <h2>{'Upload Form'|@translate}</h2> 
    9960</div> 
     
    12889<input name="upload_id" value="{$upload_id}" type="hidden"> 
    12990{/if} 
    130   <fieldset> 
    131     <legend>{'Upload Photos'|@translate}</legend> 
    13291 
    13392    <div class="formField"> 
     
    157116            <td>{'Category name'|@translate}</td> 
    158117            <td> 
    159               <input type="text" name="category_name" value="{$F_CATEGORY_NAME}" 
     118              <input type="text" name="category_name" value="{$F_CATEGORY_NAME}" style="width:400px"> 
    160119            </td> 
    161120          </tr> 
     
    209168    </p> 
    210169{/if} 
    211   </fieldset> 
    212170</form> 
    213171{/if} 
Note: See TracChangeset for help on using the changeset viewer.