Changeset 12865 for trunk/i.php
- Timestamp:
- 01/08/12 20:25:52 (17 months ago)
- Files:
-
- 1 modified
-
trunk/i.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/i.php
r12851 r12865 109 109 { 110 110 $req = $_SERVER["QUERY_STRING"]; 111 if ($pos=strpos($req, '&')) 112 { 113 $req = substr($req, 0, $pos); 114 } 111 115 /*foreach (array_keys($_GET) as $keynum => $key) 112 116 { … … 168 172 try 169 173 { 170 $pa ge['derivative_params'] = DerivativeParams::from_url_tokens($deriv);174 $params = $page['derivative_params'] = DerivativeParams::from_url_tokens($deriv); 171 175 } 172 176 catch (Exception $e) 173 177 { 174 178 ierror($e->getMessage(), 400); 179 } 180 if ($params->sizing->ideal_size[0] < 20 or $params->sizing->ideal_size[1] < 20) 181 { 182 ierror('Invalid size', 400); 183 } 184 if ($params->sizing->max_crop < 0 or $params->sizing->max_crop > 1) 185 { 186 ierror('Invalid crop', 400); 175 187 } 176 188 } … … 225 237 226 238 $params = $page['derivative_params']; 227 if ($params->sizing->ideal_size[0] < 20 or $params->sizing->ideal_size[1] < 20)228 {229 ierror('Invalid size', 400);230 }231 if ($params->sizing->max_crop < 0 or $params->sizing->max_crop > 1)232 {233 ierror('Invalid crop', 400);234 }235 239 236 240 $src_mtime = @filemtime($page['src_path']); … … 251 255 $expires=false; 252 256 $now = time(); 253 if ( $now > (max($src_mtime, $params->last_mod_time) + 24*3600) ) 257 if ( isset($_GET['b']) ) 258 { 259 $expires = $now + 100; 260 header("Cache-control: no-store, max-age=100"); 261 } 262 elseif ( $now > (max($src_mtime, $params->last_mod_time) + 24*3600) ) 254 263 {// somehow arbitrary - if derivative params or src didn't change for the last 24 hours, we send an expire header for several days 255 264 $expires = $now + 10*24*3600; … … 268 277 } 269 278 279 if (!mkgetdir(dirname($page['derivative_path']))) 280 { 281 ierror("dir create error", 500); 282 } 270 283 271 284 include_once(PHPWG_ROOT_PATH . 'admin/include/image.class.php'); … … 275 288 276 289 $image = new pwg_image($page['src_path']); 277 278 if (!mkgetdir(dirname($page['derivative_path'])))279 {280 ierror("dir create error", 500);281 }282 290 283 291 $changes = 0; … … 326 334 { 327 335 // todo 336 $pad = $wm_size[0] + max(30, round($wm_size[0]/4)); 337 for($i=-$wm->xrepeat; $i<=$wm->xrepeat; $i++) 338 { 339 if (!$i) continue; 340 $x2 = $x + $i * $pad; 341 if ($x2>=0 && $x2+$wm_size[0]<$d_size[0]) 342 if (!$image->compose($wm_image, $x2, $y, $wm->opacity)) 343 break; 344 } 328 345 } 329 346 }
![(please configure the [header_logo] section in trac.ini)](http://piwigo.org/screenshots/piwigo_logo_on_white.png)