diff options
author | rvelices <rv-github@modusoptimus.com> | 2011-12-27 05:26:44 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2011-12-27 05:26:44 +0000 |
commit | 753f58d6a966a1051dcd62a3eeab8fc18798bcac (patch) | |
tree | 2ebbfec86d511aa980e0d23c170bfa5006a8793e /admin | |
parent | e77e68b7db17c28c1ca44f4865758f2afb871d07 (diff) |
feature 2541 multisize
- core implementation + usage on most public/admin pages
- still to do: sync process, upload, gui/persistence for size parameters, migration script, center of interest ...
git-svn-id: http://piwigo.org/svn/trunk@12796 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin/batch_manager_global.php | 4 | ||||
-rw-r--r-- | admin/batch_manager_unit.php | 4 | ||||
-rw-r--r-- | admin/cat_modify.php | 8 | ||||
-rw-r--r-- | admin/comments.php | 4 | ||||
-rw-r--r-- | admin/element_set_ranks.php | 10 | ||||
-rw-r--r-- | admin/history.php | 12 | ||||
-rw-r--r-- | admin/picture_modify.php | 2 | ||||
-rw-r--r-- | admin/rating.php | 4 | ||||
-rw-r--r-- | admin/rating_user.php | 6 | ||||
-rw-r--r-- | admin/themes/default/template/rating_user.tpl | 4 |
10 files changed, 30 insertions, 28 deletions
diff --git a/admin/batch_manager_global.php b/admin/batch_manager_global.php index befbf2d48..74e1a6a21 100644 --- a/admin/batch_manager_global.php +++ b/admin/batch_manager_global.php @@ -711,7 +711,7 @@ if (count($page['cat_elements_id']) > 0) $query = ' -SELECT id,path,tn_ext,file,filesize,level,name +SELECT id,path,representative_ext,file,filesize,level,name FROM '.IMAGES_TABLE; if ($is_category) @@ -747,7 +747,7 @@ SELECT id,path,tn_ext,file,filesize,level,name while ($row = pwg_db_fetch_assoc($result)) { $nb_thumbs_page++; - $src = get_thumbnail_url($row); + $src = DerivativeImage::thumb_url($row); $title = $row['name']; if (empty($title)) diff --git a/admin/batch_manager_unit.php b/admin/batch_manager_unit.php index 4c0d7227d..36593a40f 100644 --- a/admin/batch_manager_unit.php +++ b/admin/batch_manager_unit.php @@ -201,7 +201,7 @@ if (count($page['cat_elements_id']) > 0) $query = ' -SELECT id,path,tn_ext,name,date_creation,comment,author,level,file +SELECT id,path,representative_ext,name,date_creation,comment,author,level,file FROM '.IMAGES_TABLE; if ($is_category) @@ -237,7 +237,7 @@ SELECT id,path,tn_ext,name,date_creation,comment,author,level,file { array_push($element_ids, $row['id']); - $src = get_thumbnail_url($row); + $src = DerivativeImage::thumb_url($row); // creation date if (!empty($row['date_creation'])) diff --git a/admin/cat_modify.php b/admin/cat_modify.php index 8b83fd205..8c4d59ae9 100644 --- a/admin/cat_modify.php +++ b/admin/cat_modify.php @@ -301,12 +301,12 @@ if ($category['has_images'] if (!empty($category['representative_picture_id'])) { $query = ' -SELECT id,tn_ext,path +SELECT id,representative_ext,path FROM '.IMAGES_TABLE.' WHERE id = '.$category['representative_picture_id'].' ;'; $row = pwg_db_fetch_assoc(pwg_query($query)); - $src = get_thumbnail_url($row); + $src = DerivativeImage::thumb_url($row); $url = get_root_url().'admin.php?page=picture_modify'; $url.= '&image_id='.$category['representative_picture_id']; @@ -387,7 +387,7 @@ if (isset($_POST['submitEmail']) and !empty($_POST['group'])) if (!empty($category['representative_picture_id'])) { $query = ' -SELECT id, file, path, tn_ext +SELECT id, file, path, representative_ext FROM '.IMAGES_TABLE.' WHERE id = '.$category['representative_picture_id'].' ;'; @@ -403,7 +403,7 @@ SELECT id, file, path, tn_ext 'image_file' => $element['file'], 'category' => $category )) - .'" class="thumblnk"><img src="'.get_thumbnail_url($element).'"></a>'; + .'" class="thumblnk"><img src="'.DerivativeImage::thumb_url($element).'"></a>'; } } diff --git a/admin/comments.php b/admin/comments.php index a8f593705..6bab34067 100644 --- a/admin/comments.php +++ b/admin/comments.php @@ -99,7 +99,7 @@ $list = array(); $query = ' SELECT c.id, c.image_id, c.date, c.author, '. -$conf['user_fields']['username'].' AS username, c.content, i.path, i.tn_ext +$conf['user_fields']['username'].' AS username, c.content, i.path, i.representative_ext FROM '.COMMENTS_TABLE.' AS c INNER JOIN '.IMAGES_TABLE.' AS i ON i.id = c.image_id @@ -111,7 +111,7 @@ $conf['user_fields']['username'].' AS username, c.content, i.path, i.tn_ext $result = pwg_query($query); while ($row = pwg_db_fetch_assoc($result)) { - $thumb = get_thumbnail_url( + $thumb = DerivativeImage::thumb_url( array( 'id'=>$row['image_id'], 'path'=>$row['path'], diff --git a/admin/element_set_ranks.php b/admin/element_set_ranks.php index 972a13a19..6de933904 100644 --- a/admin/element_set_ranks.php +++ b/admin/element_set_ranks.php @@ -199,7 +199,8 @@ SELECT id, file, path, - tn_ext, + representative_ext, + width, height, name, rank FROM '.IMAGES_TABLE.' @@ -214,11 +215,12 @@ if (pwg_db_num_rows($result) > 0) $current_rank = 1; $thumbnail_info=array(); $clipping=array(); + $derivativeParams = ImageStdParams::get_by_type(IMG_SQUARE); while ($row = pwg_db_fetch_assoc($result)) { - $src = get_thumbnail_url($row); + $derivative = new DerivativeImage($derivativeParams, new SrcImage($row)); - $thumbnail_size = getimagesize($src); + $thumbnail_size = $derivative->get_size(); if ( !empty( $row['name'] ) ) { $thumbnail_name = $row['name']; @@ -233,7 +235,7 @@ if (pwg_db_num_rows($result) > 0) 'width' => $thumbnail_size[0], 'height' => $thumbnail_size[1], 'id' => $row['id'], - 'tn_src' => $src, + 'tn_src' => $derivative->get_url(), 'rank' => $current_rank * 10, ); if ($thumbnail_size[0]<=128 and $thumbnail_size[1]<=128) diff --git a/admin/history.php b/admin/history.php index cbc4a2cdf..f8d4a253b 100644 --- a/admin/history.php +++ b/admin/history.php @@ -303,7 +303,7 @@ SELECT high_filesize, file, path, - tn_ext + representative_ext FROM '.IMAGES_TABLE.' WHERE id IN ('.implode(',', array_keys($image_ids)).') ;'; @@ -313,7 +313,7 @@ SELECT $high_filesize_of_image = array(); $file_of_image = array(); $path_of_image = array(); - $tn_ext_of_image = array(); + $representative_ext_of_image = array(); $result = pwg_query($query); while ($row = pwg_db_fetch_assoc($result)) @@ -332,7 +332,7 @@ SELECT $file_of_image[ $row['id'] ] = $row['file']; $path_of_image[ $row['id'] ] = $row['path']; - $tn_ext_of_image[ $row['id'] ] = $row['tn_ext']; + $representative_ext_of_image[ $row['id'] ] = $row['representative_ext']; } // echo '<pre>'; print_r($high_filesize_of_image); echo '</pre>'; @@ -454,7 +454,7 @@ SELECT 'id' => $line['image_id'], 'file' => $file_of_image[$line['image_id']], 'path' => $path_of_image[$line['image_id']], - 'tn_ext' => $tn_ext_of_image[$line['image_id']], + 'representative_ext' => $representative_ext_of_image[$line['image_id']], ); $thumbnail_display = $page['search']['fields']['display_thumbnail']; } @@ -487,7 +487,7 @@ SELECT { $image_string = '<a class="thumbnail" href="'.$picture_url.'">' - .'<span><img src="'.get_thumbnail_url($element) + .'<span><img src="'.DerivativeImage::thumb_url($element) .'" alt="'.$image_title.'" title="'.$image_title.'">' .'</span></a>'; break; @@ -496,7 +496,7 @@ SELECT { $image_string = '<a class="over" href="'.$picture_url.'">' - .'<span><img src="'.get_thumbnail_url($element) + .'<span><img src="'.DerivativeImage::thumb_url($element) .'" alt="'.$image_title.'" title="'.$image_title.'">' .'</span>'.$image_title.'</a>'; break; diff --git a/admin/picture_modify.php b/admin/picture_modify.php index daf17939f..57a78aaf2 100644 --- a/admin/picture_modify.php +++ b/admin/picture_modify.php @@ -282,7 +282,7 @@ $template->assign( 'PATH'=>$row['path'], - 'TN_SRC' => get_thumbnail_url($row), + 'TN_SRC' => DerivativeImage::thumb_url($row), 'NAME' => isset($_POST['name']) ? diff --git a/admin/rating.php b/admin/rating.php index 70dc10fc3..559d48523 100644 --- a/admin/rating.php +++ b/admin/rating.php @@ -184,7 +184,7 @@ SELECT i.id, GROUP BY i.id, i.path, i.file, - i.tn_ext, + i.representative_ext, i.rating_score, r.element_id ORDER BY ' . $available_order_by[$order_by_index][1] .' @@ -201,7 +201,7 @@ while ($row = pwg_db_fetch_assoc($result)) $template->assign( 'images', array() ); foreach ($images as $image) { - $thumbnail_src = get_thumbnail_url($image); + $thumbnail_src = DerivativeImage::thumb_url($image); $image_url = PHPWG_ROOT_PATH.'admin.php?page=picture_modify'. '&image_id='.$image['id']; diff --git a/admin/rating_user.php b/admin/rating_user.php index e42afe39a..bcffa3df7 100644 --- a/admin/rating_user.php +++ b/admin/rating_user.php @@ -101,14 +101,14 @@ while ($row = pwg_db_fetch_assoc($result)) $image_urls = array(); if (count($image_ids) > 0 ) { - $query = 'SELECT id, name, file, path, tn_ext + $query = 'SELECT id, name, file, path, representative_ext FROM '.IMAGES_TABLE.' WHERE id IN ('.implode(',', array_keys($image_ids)).')'; $result = pwg_query($query); while ($row = pwg_db_fetch_assoc($result)) { $image_urls[ $row['id'] ] = array( - 'tn' => get_thumbnail_url($row), + 'tn' => DerivativeImage::thumb_url($row), 'page' => make_picture_url( array('image_id'=>$row['id'], 'image_file'=>$row['file']) ), ); } @@ -217,7 +217,7 @@ $template->assign( array( 'available_rates' => $conf['rate_items'], 'ratings' => $by_user_ratings, 'image_urls' => $image_urls, - 'TN_WIDTH' => 20+2*$conf['upload_form_thumb_maxwidth'], + 'TN_WIDTH' => 28+2*ImageStdParams::get_by_type(IMG_THUMB)->sizing->ideal_size[0], ) ); $template->set_filename('rating', 'rating_user.tpl'); $template->assign_var_from_handle('ADMIN_CONTENT', 'rating'); diff --git a/admin/themes/default/template/rating_user.tpl b/admin/themes/default/template/rating_user.tpl index 72d6a26ce..7cc36c4fb 100644 --- a/admin/themes/default/template/rating_user.tpl +++ b/admin/themes/default/template/rating_user.tpl @@ -59,7 +59,7 @@ function del(elt,uid,aid) <td>{if !empty($rates)} {capture assign=rate_over}{foreach from=$rates item=rate_arr}<img src="{$image_urls[$rate_arr.id].tn}" alt="thumb-{$rate_arr.id}" title="{$rate_arr.date}"></img> {/foreach}{/capture} - <a class="cluetip" title="{$rate_over|@htmlspecialchars}">{$rates|@count}</a> + <a class="cluetip" title="|{$rate_over|@htmlspecialchars}">{$rates|@count}</a> {/if}</td> {/foreach} <td><a onclick="return del(this,{$rating.uid},'{$rating.aid}');"><img src="{$themeconf.admin_icon_dir}/delete.png" alt="[{'Delete'|@translate}]"></a></td> @@ -71,7 +71,7 @@ function del(elt,uid,aid) {footer_script require='jquery.cluetip'} jQuery(document).ready(function(){ldelim} jQuery('.cluetip').cluetip({ldelim} - width: {$TN_WIDTH}, splitTitle: '|' + width: {$TN_WIDTH}, showTitle:false, splitTitle: '|' }); }) {/footer_script}
\ No newline at end of file |