source: trunk/admin/picture_coi.php @ 13978

Last change on this file since 13978 was 13077, checked in by plg, 13 years ago

feature 2564: redesign on photo administration screen.

  • one screen with several tabs (for now: properties + coi)
  • double select boxes for album associations and representation have been converted to simple multiple select boxes with jQuery Chosen
  • more details about the photo in an introduction text
File size: 3.8 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Piwigo - a PHP based photo gallery                                    |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2008-2012 Piwigo Team                  http://piwigo.org |
6// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
7// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
8// +-----------------------------------------------------------------------+
9// | This program is free software; you can redistribute it and/or modify  |
10// | it under the terms of the GNU General Public License as published by  |
11// | the Free Software Foundation                                          |
12// |                                                                       |
13// | This program is distributed in the hope that it will be useful, but   |
14// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
15// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
16// | General Public License for more details.                              |
17// |                                                                       |
18// | You should have received a copy of the GNU General Public License     |
19// | along with this program; if not, write to the Free Software           |
20// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
21// | USA.                                                                  |
22// +-----------------------------------------------------------------------+
23
24if(!defined("PHPWG_ROOT_PATH"))
25{
26  die('Hacking attempt!');
27}
28
29// +-----------------------------------------------------------------------+
30// | Check Access and exit when user status is not ok                      |
31// +-----------------------------------------------------------------------+
32check_status(ACCESS_ADMINISTRATOR);
33
34check_input_parameter('image_id', $_GET, false, PATTERN_ID);
35
36if (isset($_POST['submit']))
37{
38  $query = 'UPDATE '.IMAGES_TABLE;
39  if (strlen($_POST['l'])==0)
40  {
41    $query .= ' SET coi=NULL';
42  }
43  else
44  {
45    $coi = fraction_to_char($_POST['l'])
46      .fraction_to_char($_POST['t'])
47      .fraction_to_char($_POST['r'])
48      .fraction_to_char($_POST['b']);
49    $query .= ' SET coi=\''.$coi.'\'';
50  }
51  $query .= ' WHERE id='.$_GET['image_id'];
52  pwg_query($query);
53}
54
55$query = 'SELECT * FROM '.IMAGES_TABLE.' WHERE id='.$_GET['image_id'];
56$row = pwg_db_fetch_assoc( pwg_query($query) );
57
58if (isset($_POST['submit']))
59{
60  foreach(ImageStdParams::get_defined_type_map() as $params)
61  {
62    if ($params->sizing->max_crop != 0)
63    {
64      delete_element_derivatives($row, $params->type);
65    }
66  }
67  delete_element_derivatives($row, IMG_CUSTOM);
68  $uid = '&b='.time();
69  $conf['question_mark_in_urls'] = $conf['php_extension_in_urls'] = true;
70  if ($conf['derivative_url_style']==1)
71  {
72    $conf['derivative_url_style']=0; //auto
73  }
74}
75else
76{
77  $uid = '';
78}
79
80$tpl_var = array(
81  'TITLE' => render_element_name($row),
82  'ALT' => $row['file'],
83  'U_IMG' => DerivativeImage::url(IMG_LARGE, $row),
84  );
85
86if (!empty($row['coi']))
87{
88  $tpl_var['coi'] = array(
89    'l'=> char_to_fraction($row['coi'][0]),
90    't'=> char_to_fraction($row['coi'][1]),
91    'r'=> char_to_fraction($row['coi'][2]),
92    'b'=> char_to_fraction($row['coi'][3]),
93  );
94}
95
96foreach(ImageStdParams::get_defined_type_map() as $params)
97{
98  if ($params->sizing->max_crop != 0)
99  {
100    $derivative = new DerivativeImage($params, new SrcImage($row) );
101    $template->append( 'cropped_derivatives', array( 
102      'U_IMG' => $derivative->get_url().$uid,
103      'HTM_SIZE' => $derivative->get_size_htm(),
104    ) );
105  }
106}
107
108
109$template->assign($tpl_var);
110$template->set_filename('picture_coi', 'picture_coi.tpl');
111
112$template->assign_var_from_handle('ADMIN_CONTENT', 'picture_coi');
113?>
Note: See TracBrowser for help on using the repository browser.