Changeset 23125
- Timestamp:
- Jun 10, 2013, 3:50:22 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/automatic_size/main.inc.php
r23074 r23125 26 26 { 27 27 global $conf; 28 29 $asize_conf_default_values = array( 30 'automatic_size_width_margin' => 12, 31 'automatic_size_height_margin' => 40, 32 'automatic_size_min_ratio' => 0.2, 33 'automatic_size_max_ratio' => 5, 34 ); 35 36 foreach (array_keys($asize_conf_default_values) as $key) 37 { 38 if (!isset($conf[$key])) 39 { 40 $conf[$key] = $asize_conf_default_values[$key]; 41 } 42 } 28 43 29 44 if ( !empty($content) ) … … 66 81 if ($size) 67 82 { 68 if ($size[0] <= $available_size[0] and $size[1] <= $available_size[1]) 83 // if we have a very high picture (such as an infographic), we only try to match width 84 if ($size[0]/$size[1] < $conf['automatic_size_min_ratio']) 69 85 { 70 $automatic_size = $type; 86 if ($size[0] <= $available_size[0]) 87 { 88 $automatic_size = $type; 89 } 90 } 91 // if we have a very wide picture (panoramic), we only try to match height 92 elseif ($size[0]/$size[1] > $conf['automatic_size_max_ratio']) 93 { 94 if ($size[1] <= $available_size[1]) 95 { 96 $automatic_size = $type; 97 } 98 } 99 else 100 { 101 if ($size[0] <= $available_size[0] and $size[1] <= $available_size[1]) 102 { 103 $automatic_size = $type; 104 } 71 105 } 72 106 } … … 127 161 'ALT_IMG' => $element_info['file'], 128 162 'COOKIE_PATH' => cookie_path(), 129 'asize_width_margin' => isset($conf['automatic_size_width_margin']) ? $conf['automatic_size_width_margin'] : 12,130 'asize_height_margin' => isset($conf['automatic_size_height_margin']) ? $conf['automatic_size_height_margin'] : 40,163 'asize_width_margin' => $conf['automatic_size_width_margin'], 164 'asize_height_margin' => $conf['automatic_size_height_margin'], 131 165 ) 132 166 );
Note: See TracChangeset
for help on using the changeset viewer.