- Timestamp:
- Feb 19, 2012, 4:18:44 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/derivative.inc.php
r13170 r13252 272 272 } 273 273 274 function get_scaled_size($maxw, $maxh) 275 { 276 $size = $this->get_size(); 277 if ($size) 278 { 279 $ratio_w = $size[0] / $maxw; 280 $ratio_h = $size[1] / $maxh; 281 if ($ratio_w>1 || $ratio_h>1) 282 { 283 if ($ratio_w > $ratio_h) 284 { 285 $size[0] = $maxw; 286 $size[1] = floor($size[1] / $ratio_w); 287 } 288 else 289 { 290 $size[0] = floor($size[0] / $ratio_h); 291 $size[1] = $maxh; 292 } 293 } 294 } 295 return $size; 296 } 297 298 function get_scaled_size_htm($maxw=9999, $maxh=9999) 299 { 300 $size = $this->get_scaled_size($maxw, $maxh); 301 if ($size) 302 { 303 return 'width="'.$size[0].'" height="'.$size[1].'"'; 304 } 305 } 274 306 } 275 307
Note: See TracChangeset
for help on using the changeset viewer.