1 | <?php |
---|
2 | $visible=(isset($visible))?$visible:false; |
---|
3 | |
---|
4 | $cl_version=isset($cl_version)?$cl_version:""; |
---|
5 | $cl_plugin=isset($cl_plugin)?$cl_plugin:""; |
---|
6 | $cl_visible=isset($conf['cl_auto']) ? $conf['cl_auto'] : |
---|
7 | (isset($_GET['cl_visible'])?$_GET['cl_visible']:'true') |
---|
8 | |
---|
9 | ; |
---|
10 | //============================================================================== |
---|
11 | $DEBUG_autosize = isset($_POST['cl_debug_conflit']) ? $_POST['cl_debug_conflit'] : "false" ; |
---|
12 | $DEBUG_autosize = isset($_GET['cl_debug_conflit']) ? $_GET['cl_debug_conflit'] : $DEBUG_autosize ; |
---|
13 | $DEBUG_autosize = isset($conf['cl_debug_conflit']) ? $conf['cl_debug_conflit'] : $DEBUG_autosize ; |
---|
14 | //=========================================================================== |
---|
15 | $cookies="' x '"; |
---|
16 | |
---|
17 | $current = $template->get_template_vars('current'); |
---|
18 | if (isset($_COOKIE['picture_deriv'])) |
---|
19 | { |
---|
20 | if (isset($_COOKIE['theImageWidth'])) |
---|
21 | $cookies = '"'.$_COOKIE['theImageWidth']." x ". $_COOKIE['theImageHeight'] .'"'; |
---|
22 | |
---|
23 | if ( array_key_exists($_COOKIE['picture_deriv'], ImageStdParams::get_defined_type_map()) ) |
---|
24 | { |
---|
25 | pwg_set_session_var('picture_deriv', $_COOKIE['picture_deriv']); |
---|
26 | } |
---|
27 | setcookie('picture_deriv', false, 0, cookie_path() ); |
---|
28 | } |
---|
29 | $deriv_type = pwg_get_session_var('picture_deriv', $conf['derivative_default_size']); |
---|
30 | $defined_types = array_keys(ImageStdParams::get_defined_type_map()); |
---|
31 | |
---|
32 | if (isset($current)){ |
---|
33 | if (!isset($current['selected_derivative'])){ |
---|
34 | $model= $defined_types[count($defined_types)-1]; |
---|
35 | $selected_derivative = $current['derivatives'][$model]; |
---|
36 | $img_all= $derivative->get_all($derivative->src_image); |
---|
37 | $template->append('current', array( |
---|
38 | 'selected_derivative' => $selected_derivative |
---|
39 | ), true); |
---|
40 | |
---|
41 | |
---|
42 | $current = $template->get_template_vars('current'); |
---|
43 | } |
---|
44 | $derivative=$current['selected_derivative'] ; |
---|
45 | $imgScaledWH=$derivative->src_image->get_size(); |
---|
46 | $imgSizeWH = $derivative->get_size(); |
---|
47 | $img_type = $derivative->get_type(); |
---|
48 | $img_url = $derivative->get_url(); |
---|
49 | $img_all= $derivative->get_all($derivative->src_image); |
---|
50 | $scaled_size=$derivative->get_size_hr(); //792 x 441 |
---|
51 | $scaled_size=$derivative->get_scaled_size_htm(); // width="792" height="441" |
---|
52 | //================= taille mis a l'échelle |
---|
53 | $scaled_size=$derivative->get_scaled_size(100,100); // array([0]=>100,[1]=>55) |
---|
54 | $src= $derivative->src_image ; |
---|
55 | |
---|
56 | } |
---|
57 | |
---|
58 | $img_width=isset($imgScaledWH)?$imgSizeWH[0]:"480"; |
---|
59 | $img_height=isset($imgScaledWH)?$imgSizeWH[1]:"320"; |
---|
60 | |
---|
61 | $img_scaled_width=isset($imgScaledWH)?$imgScaledWH[0]:"480"; |
---|
62 | $img_scaled_height=isset($imgScaledWH)?$imgScaledWH[1]:"320"; |
---|
63 | |
---|
64 | |
---|
65 | |
---|
66 | $src_img_h=isset($_POST['src_img_h'])?$_POST['src_img_h']: $img_height ; |
---|
67 | $src_img_w= isset($_POST['src_img_w'])?$_POST['src_img_w']: $img_width ; |
---|
68 | |
---|
69 | $window_height= isset($_POST['window_height'])?$_POST['window_height']: $img_scaled_height ; |
---|
70 | $window_width= isset($_POST['window_width'])?$_POST['window_width']: $img_scaled_width ; |
---|
71 | global $size ; |
---|
72 | $size= array( |
---|
73 | 'src_img_h' => $src_img_h, |
---|
74 | 'src_img_w' => $src_img_w, |
---|
75 | 'window_height' =>$window_height, |
---|
76 | 'window_width' => $window_width |
---|
77 | ); |
---|
78 | |
---|
79 | $my_path = AUTOSIZE_PATH_ABS; |
---|
80 | $theme=$user['theme']; |
---|
81 | $user_status = $user['status'] ; |
---|
82 | |
---|
83 | $template->assign( array( |
---|
84 | 'AUTOSIZE_PATH_ABS' => AUTOSIZE_PATH_ABS, |
---|
85 | 'ROOT_URL' => ROOT_URL, |
---|
86 | 'AUTOSIZE_PATH' => AUTOSIZE_PATH, |
---|
87 | ) |
---|
88 | ); |
---|
89 | if (!isset($conf['prefix_thumbnail'])) $conf['prefix_thumbnail']="TN_"; |
---|
90 | |
---|
91 | |
---|
92 | //====================================================== |
---|
93 | |
---|
94 | $options['Autosize'] = ''.l10n('Autosize').''; |
---|
95 | foreach ($defined_types as $type_size){ |
---|
96 | $value = $type_size; |
---|
97 | $options[$value] = $type_size; |
---|
98 | } |
---|
99 | //=================== |
---|
100 | $value=0; |
---|
101 | $liste_type=""; |
---|
102 | if(isset($img_all )) |
---|
103 | foreach ($img_all as $img_select){ |
---|
104 | $imgSizeWH = $img_select->get_size(); |
---|
105 | $img_type = $img_select->get_type(); |
---|
106 | $img_url = $img_select->get_url(); |
---|
107 | |
---|
108 | $liste_type .= $img_type.",".$img_url.",".$imgSizeWH[0] .",".$imgSizeWH[1]."|" ; |
---|
109 | if(strtolower($img_type)=="original") break ; |
---|
110 | |
---|
111 | |
---|
112 | } |
---|
113 | |
---|
114 | //=================================== |
---|
115 | |
---|
116 | $template->assign( |
---|
117 | array( |
---|
118 | 'ratio' =>$img_scaled_width/$img_scaled_height , |
---|
119 | 'cookies' => $cookies , |
---|
120 | 'deriv_type' =>$deriv_type , |
---|
121 | 'liste_type' => $liste_type , |
---|
122 | 'webmaster_type' => array( |
---|
123 | 'OPTIONS' => $options, |
---|
124 | 'SELECTED' => $autosize_parametres->webmaster_type |
---|
125 | ), |
---|
126 | 'admin_type' => array( |
---|
127 | 'OPTIONS' => $options, |
---|
128 | 'SELECTED' => $autosize_parametres->admin_type |
---|
129 | ), |
---|
130 | 'generic_type' => array( |
---|
131 | 'OPTIONS' => $options, |
---|
132 | 'SELECTED' => $autosize_parametres->generic_type |
---|
133 | ), |
---|
134 | 'guest_type' => array( |
---|
135 | 'OPTIONS' => $options, |
---|
136 | 'SELECTED' => $autosize_parametres->guest_type |
---|
137 | ), |
---|
138 | 'normal_type' => array( |
---|
139 | 'OPTIONS' => $options, |
---|
140 | 'SELECTED' => $autosize_parametres->normal_type |
---|
141 | ), |
---|
142 | 'DEBUG_autosize' => $DEBUG_autosize , |
---|
143 | 'cl_visible' => $cl_visible, |
---|
144 | 'cl_version' => $cl_version, |
---|
145 | 'cl_plugin' => $cl_plugin, |
---|
146 | |
---|
147 | 'fade_in' => $autosize_parametres->fade_in, |
---|
148 | 'thumbnail' => $conf['prefix_thumbnail'], |
---|
149 | 'visible' => $visible, |
---|
150 | |
---|
151 | 'theme' => $theme, |
---|
152 | 'SCALED_WIDTH' => $img_scaled_width, |
---|
153 | 'SCALED_HEIGHT' => $img_scaled_height, |
---|
154 | |
---|
155 | 'IMG_WIDTH' => $img_width, |
---|
156 | 'IMG_HEIGHT' => $img_height, |
---|
157 | |
---|
158 | 'MINI_HEIGHT' => $autosize_parametres->mini_height, |
---|
159 | 'MINI_WIDTH' => $autosize_parametres->mini_width, |
---|
160 | 'MINI_HEIGHT2' => $autosize_parametres->mini_height2, |
---|
161 | 'MINI_WIDTH2' => $autosize_parametres->mini_width2, |
---|
162 | |
---|
163 | 'MARGE_BASSE' => $autosize_parametres->marge_basse, |
---|
164 | 'ECHELLE_MAX' => $autosize_parametres->echelle_max, |
---|
165 | |
---|
166 | |
---|
167 | 'check_icon_v' => ($autosize_parametres->check_icon_v == 'on') ? 'checked="checked"' : '' , |
---|
168 | 'check_desc_v' => ($autosize_parametres->check_desc_v == 'on') ? 'checked="checked"' : '' , |
---|
169 | |
---|
170 | |
---|
171 | 'webmaster_enabled' => ($autosize_parametres->webmaster_enabled == 'on') ? 'checked="checked"' : '' , |
---|
172 | 'admin_enabled' => ($autosize_parametres->admin_enabled == 'on') ? 'checked="checked"' : '' , |
---|
173 | 'generic_enabled' => ($autosize_parametres->generic_enabled == 'on') ? 'checked="checked"' : '' , |
---|
174 | 'guest_enabled' => ($autosize_parametres->guest_enabled == 'on') ? 'checked="checked"' : '' , |
---|
175 | 'normal_enabled' => ($autosize_parametres->normal_enabled == 'on') ? 'checked="checked"' : '' , |
---|
176 | |
---|
177 | 'user_status' => get_user_status($user_status) , |
---|
178 | 'Size' => $size |
---|
179 | |
---|
180 | |
---|
181 | ) |
---|
182 | ); |
---|
183 | |
---|
184 | |
---|
185 | //unset($_POST); |
---|
186 | ?> |
---|