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