Changeset 896
- Timestamp:
- 04/24/08 10:22:17 (9 months ago)
- Files:
-
- branches/1.0.x/lib/jelix/CREDITS (modified) (1 diff)
- branches/1.0.x/lib/jelix/CREDITS (modified) (1 diff)
- branches/1.0.x/lib/jelix/CREDITS (modified) (1 diff)
- branches/1.0.x/lib/jelix/CREDITS (modified) (1 diff)
- branches/1.0.x/lib/jelix/plugins/tpl/html/function.image.php (modified) (9 diffs)
- branches/1.0.x/lib/jelix/plugins/tpl/html/function.image.php (modified) (9 diffs)
- branches/1.0.x/lib/jelix/plugins/tpl/html/function.image.php (modified) (9 diffs)
- branches/1.0.x/lib/jelix/plugins/tpl/html/function.image.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.0.x/lib/jelix/CREDITS
r887 r896 93 93 94 94 Kévin Lepeltier (aka Lipki) 95 - plugin image for jtpl (#474, #502 )95 - plugin image for jtpl (#474, #502, #559, #560) 96 96 - bug fixed in firebug support (#500) 97 97 branches/1.0.x/lib/jelix/CREDITS
r887 r896 93 93 94 94 Kévin Lepeltier (aka Lipki) 95 - plugin image for jtpl (#474, #502 )95 - plugin image for jtpl (#474, #502, #559, #560) 96 96 - bug fixed in firebug support (#500) 97 97 branches/1.0.x/lib/jelix/CREDITS
r887 r896 93 93 94 94 Kévin Lepeltier (aka Lipki) 95 - plugin image for jtpl (#474, #502 )95 - plugin image for jtpl (#474, #502, #559, #560) 96 96 - bug fixed in firebug support (#500) 97 97 branches/1.0.x/lib/jelix/CREDITS
r887 r896 93 93 94 94 Kévin Lepeltier (aka Lipki) 95 - plugin image for jtpl (#474, #502 )95 - plugin image for jtpl (#474, #502, #559, #560) 96 96 - bug fixed in firebug support (#500) 97 97 branches/1.0.x/lib/jelix/plugins/tpl/html/function.image.php
r882 r896 10 10 11 11 /** 12 * image plugin : write the url corresponding to the image 13 * 12 14 * Add a link to the image, 13 15 * The image is resized, and cached … … 18 20 * width :uint 19 21 * height :uint 22 * maxwidth :uint only with maxheight 23 * maxheight :uint only with maxwidth 20 24 * zoom 1-100 21 25 * omo :boolean … … 30 34 * sopacity :uint 31 35 * scolor #000000 :string 36 * background #000000 :string 32 37 * 33 38 * gif -> image/gif … … 40 45 * png -> image/png 41 46 * other -> image/png 42 */43 44 /**45 * image plugin : write the url corresponding to the image46 47 * 47 48 * @param jTpl $tpl template engine … … 61 62 && strpos($_SERVER["HTTP_USER_AGENT"], 'MSIE') !== false 62 63 && strpos($_SERVER["HTTP_USER_AGENT"], 'MSIE 7') === false) { 63 $params['background'] = array(255, 255, 255);64 $params['background'] = '#ffffff'; 64 65 } 65 66 … … 82 83 // Cache and make changes if necessary. 83 84 if( is_file($origine_path) && !is_file($cache_path) ) { 84 $att = array('width'=>'', 'height'=>'', ' zoom'=>'', 'alignh'=>'', 'alignv'=>'', 'ext'=>'', 'quality'=>'', 'shadow'=>'');85 $att = array('width'=>'', 'height'=>'', 'maxwidth'=>'', 'maxheight'=>'', 'zoom'=>'', 'alignh'=>'', 'alignv'=>'', 'ext'=>'', 'quality'=>'', 'shadow'=>''); 85 86 if( count(array_intersect_key($params, $att)) ) 86 87 jtpl_function_html_image_inCache($src, $cachename, $params); … … 95 96 $att['src'] = $origine_www; 96 97 $att['style'] = empty($att['style'])?'':$att['style']; 97 if( !empty($params['width']) ) $att['style'] .= 'width: '.$params['width'].'px;'; 98 if( !empty($params['height']) ) $att['style'] .= 'height: '.$params['height'].'px;'; 98 if( !empty($params['width']) ) $att['style'] .= 'width: '.$params['width'].'px;'; 99 else if( !empty($params['maxwidth']) ) $att['style'] .= 'width: '.$params['maxwidth'].'px;'; 100 if( !empty($params['height']) ) $att['style'] .= 'height: '.$params['height'].'px;'; 101 else if( !empty($params['maxheight']) ) $att['style'] .= 'height: '.$params['maxheight'].'px;'; 99 102 } else 100 103 $att['src'] = $cache_www; … … 131 134 case 'image/x-xpixmap' : $image = imagecreatefromxpm($origine_www); break; 132 135 default : return ; 136 } 137 138 if(!empty($array['maxwidth']) && !empty($array['maxheight'])) { 139 140 $rapy = imagesy($image)/$array['maxwidth']; 141 $rapx = imagesx($image)/$array['maxheight']; 142 143 if( $rapy > $rapx ) { 144 $array['height'] = $array['maxheight']; 145 $array['width'] = imagesx($image)/$rapy; 146 } else { 147 $array['width'] = $array['maxwidth']; 148 $array['height'] = imagesy($image)/$rapx; 149 } 133 150 } 134 151 … … 193 210 // Background 194 211 if( !empty($array['background']) ) { 212 $array['background'] = str_replace('#', '', $array['background']); 213 $rgb = array(0,0,0); 214 for ($x=0;$x<3;$x++) $rgb[$x] = hexdec(substr($array['background'],(2*$x),2)); 195 215 $fond = imagecreatetruecolor(imagesx($image), imagesy($image)); 196 imagefill( $fond, 0, 0, imagecolorallocate( $fond, 255, 255, 255) );216 imagefill( $fond, 0, 0, imagecolorallocate( $fond, $rgb[0], $rgb[1], $rgb[2]) ); 197 217 imagecopy( $fond, $image, 0, 0, 0, 0, imagesx($image), imagesy($image)); 198 218 $image = $fond; branches/1.0.x/lib/jelix/plugins/tpl/html/function.image.php
r882 r896 10 10 11 11 /** 12 * image plugin : write the url corresponding to the image 13 * 12 14 * Add a link to the image, 13 15 * The image is resized, and cached … … 18 20 * width :uint 19 21 * height :uint 22 * maxwidth :uint only with maxheight 23 * maxheight :uint only with maxwidth 20 24 * zoom 1-100 21 25 * omo :boolean … … 30 34 * sopacity :uint 31 35 * scolor #000000 :string 36 * background #000000 :string 32 37 * 33 38 * gif -> image/gif … … 40 45 * png -> image/png 41 46 * other -> image/png 42 */43 44 /**45 * image plugin : write the url corresponding to the image46 47 * 47 48 * @param jTpl $tpl template engine … … 61 62 && strpos($_SERVER["HTTP_USER_AGENT"], 'MSIE') !== false 62 63 && strpos($_SERVER["HTTP_USER_AGENT"], 'MSIE 7') === false) { 63 $params['background'] = array(255, 255, 255);64 $params['background'] = '#ffffff'; 64 65 } 65 66 … … 82 83 // Cache and make changes if necessary. 83 84 if( is_file($origine_path) && !is_file($cache_path) ) { 84 $att = array('width'=>'', 'height'=>'', ' zoom'=>'', 'alignh'=>'', 'alignv'=>'', 'ext'=>'', 'quality'=>'', 'shadow'=>'');85 $att = array('width'=>'', 'height'=>'', 'maxwidth'=>'', 'maxheight'=>'', 'zoom'=>'', 'alignh'=>'', 'alignv'=>'', 'ext'=>'', 'quality'=>'', 'shadow'=>''); 85 86 if( count(array_intersect_key($params, $att)) ) 86 87 jtpl_function_html_image_inCache($src, $cachename, $params); … … 95 96 $att['src'] = $origine_www; 96 97 $att['style'] = empty($att['style'])?'':$att['style']; 97 if( !empty($params['width']) ) $att['style'] .= 'width: '.$params['width'].'px;'; 98 if( !empty($params['height']) ) $att['style'] .= 'height: '.$params['height'].'px;'; 98 if( !empty($params['width']) ) $att['style'] .= 'width: '.$params['width'].'px;'; 99 else if( !empty($params['maxwidth']) ) $att['style'] .= 'width: '.$params['maxwidth'].'px;'; 100 if( !empty($params['height']) ) $att['style'] .= 'height: '.$params['height'].'px;'; 101 else if( !empty($params['maxheight']) ) $att['style'] .= 'height: '.$params['maxheight'].'px;'; 99 102 } else 100 103 $att['src'] = $cache_www; … … 131 134 case 'image/x-xpixmap' : $image = imagecreatefromxpm($origine_www); break; 132 135 default : return ; 136 } 137 138 if(!empty($array['maxwidth']) && !empty($array['maxheight'])) { 139 140 $rapy = imagesy($image)/$array['maxwidth']; 141 $rapx = imagesx($image)/$array['maxheight']; 142 143 if( $rapy > $rapx ) { 144 $array['height'] = $array['maxheight']; 145 $array['width'] = imagesx($image)/$rapy; 146 } else { 147 $array['width'] = $array['maxwidth']; 148 $array['height'] = imagesy($image)/$rapx; 149 } 133 150 } 134 151 … … 193 210 // Background 194 211 if( !empty($array['background']) ) { 212 $array['background'] = str_replace('#', '', $array['background']); 213 $rgb = array(0,0,0); 214 for ($x=0;$x<3;$x++) $rgb[$x] = hexdec(substr($array['background'],(2*$x),2)); 195 215 $fond = imagecreatetruecolor(imagesx($image), imagesy($image)); 196 imagefill( $fond, 0, 0, imagecolorallocate( $fond, 255, 255, 255) );216 imagefill( $fond, 0, 0, imagecolorallocate( $fond, $rgb[0], $rgb[1], $rgb[2]) ); 197 217 imagecopy( $fond, $image, 0, 0, 0, 0, imagesx($image), imagesy($image)); 198 218 $image = $fond; branches/1.0.x/lib/jelix/plugins/tpl/html/function.image.php
r882 r896 10 10 11 11 /** 12 * image plugin : write the url corresponding to the image 13 * 12 14 * Add a link to the image, 13 15 * The image is resized, and cached … … 18 20 * width :uint 19 21 * height :uint 22 * maxwidth :uint only with maxheight 23 * maxheight :uint only with maxwidth 20 24 * zoom 1-100 21 25 * omo :boolean … … 30 34 * sopacity :uint 31 35 * scolor #000000 :string 36 * background #000000 :string 32 37 * 33 38 * gif -> image/gif … … 40 45 * png -> image/png 41 46 * other -> image/png 42 */43 44 /**45 * image plugin : write the url corresponding to the image46 47 * 47 48 * @param jTpl $tpl template engine … … 61 62 && strpos($_SERVER["HTTP_USER_AGENT"], 'MSIE') !== false 62 63 && strpos($_SERVER["HTTP_USER_AGENT"], 'MSIE 7') === false) { 63 $params['background'] = array(255, 255, 255);64 $params['background'] = '#ffffff'; 64 65 } 65 66 … … 82 83 // Cache and make changes if necessary. 83 84 if( is_file($origine_path) && !is_file($cache_path) ) { 84 $att = array('width'=>'', 'height'=>'', ' zoom'=>'', 'alignh'=>'', 'alignv'=>'', 'ext'=>'', 'quality'=>'', 'shadow'=>'');85 $att = array('width'=>'', 'height'=>'', 'maxwidth'=>'', 'maxheight'=>'', 'zoom'=>'', 'alignh'=>'', 'alignv'=>'', 'ext'=>'', 'quality'=>'', 'shadow'=>''); 85 86 if( count(array_intersect_key($params, $att)) ) 86 87 jtpl_function_html_image_inCache($src, $cachename, $params); … … 95 96 $att['src'] = $origine_www; 96 97 $att['style'] = empty($att['style'])?'':$att['style']; 97 if( !empty($params['width']) ) $att['style'] .= 'width: '.$params['width'].'px;'; 98 if( !empty($params['height']) ) $att['style'] .= 'height: '.$params['height'].'px;'; 98 if( !empty($params['width']) ) $att['style'] .= 'width: '.$params['width'].'px;'; 99 else if( !empty($params['maxwidth']) ) $att['style'] .= 'width: '.$params['maxwidth'].'px;'; 100 if( !empty($params['height']) ) $att['style'] .= 'height: '.$params['height'].'px;'; 101 else if( !empty($params['maxheight']) ) $att['style'] .= 'height: '.$params['maxheight'].'px;'; 99 102 } else 100 103 $att['src'] = $cache_www; … … 131 134 case 'image/x-xpixmap' : $image = imagecreatefromxpm($origine_www); break; 132 135 default : return ; 136 } 137 138 if(!empty($array['maxwidth']) && !empty($array['maxheight'])) { 139 140 $rapy = imagesy($image)/$array['maxwidth']; 141 $rapx = imagesx($image)/$array['maxheight']; 142 143 if( $rapy > $rapx ) { 144 $array['height'] = $array['maxheight']; 145 $array['width'] = imagesx($image)/$rapy; 146 } else { 147 $array['width'] = $array['maxwidth']; 148 $array['height'] = imagesy($image)/$rapx; 149 } 133 150 } 134 151 … … 193 210 // Background 194 211 if( !empty($array['background']) ) { 212 $array['background'] = str_replace('#', '', $array['background']); 213 $rgb = array(0,0,0); 214 for ($x=0;$x<3;$x++) $rgb[$x] = hexdec(substr($array['background'],(2*$x),2)); 195 215 $fond = imagecreatetruecolor(imagesx($image), imagesy($image)); 196 imagefill( $fond, 0, 0, imagecolorallocate( $fond, 255, 255, 255) );216 imagefill( $fond, 0, 0, imagecolorallocate( $fond, $rgb[0], $rgb[1], $rgb[2]) ); 197 217 imagecopy( $fond, $image, 0, 0, 0, 0, imagesx($image), imagesy($image)); 198 218 $image = $fond; branches/1.0.x/lib/jelix/plugins/tpl/html/function.image.php
r882 r896 10 10 11 11 /** 12 * image plugin : write the url corresponding to the image 13 * 12 14 * Add a link to the image, 13 15 * The image is resized, and cached … … 18 20 * width :uint 19 21 * height :uint 22 * maxwidth :uint only with maxheight 23 * maxheight :uint only with maxwidth 20 24 * zoom 1-100 21 25 * omo :boolean … … 30 34 * sopacity :uint 31 35 * scolor #000000 :string 36 * background #000000 :string 32 37 * 33 38 * gif -> image/gif … … 40 45 * png -> image/png 41 46 * other -> image/png 42 */43 44 /**45 * image plugin : write the url corresponding to the image46 47 * 47 48 * @param jTpl $tpl template engine … … 61 62 && strpos($_SERVER["HTTP_USER_AGENT"], 'MSIE') !== false 62 63 && strpos($_SERVER["HTTP_USER_AGENT"], 'MSIE 7') === false) { 63 $params['background'] = array(255, 255, 255);64 $params['background'] = '#ffffff'; 64 65 } 65 66 … … 82 83 // Cache and make changes if necessary. 83 84 if( is_file($origine_path) && !is_file($cache_path) ) { 84 $att = array('width'=>'', 'height'=>'', ' zoom'=>'', 'alignh'=>'', 'alignv'=>'', 'ext'=>'', 'quality'=>'', 'shadow'=>'');85 $att = array('width'=>'', 'height'=>'', 'maxwidth'=>'', 'maxheight'=>'', 'zoom'=>'', 'alignh'=>'', 'alignv'=>'', 'ext'=>'', 'quality'=>'', 'shadow'=>''); 85 86 if( count(array_intersect_key($params, $att)) ) 86 87 jtpl_function_html_image_inCache($src, $cachename, $params); … … 95 96 $att['src'] = $origine_www; 96 97 $att['style'] = empty($att['style'])?'':$att['style']; 97 if( !empty($params['width']) ) $att['style'] .= 'width: '.$params['width'].'px;'; 98 if( !empty($params['height']) ) $att['style'] .= 'height: '.$params['height'].'px;'; 98 if( !empty($params['width']) ) $att['style'] .= 'width: '.$params['width'].'px;'; 99 else if( !empty($params['maxwidth']) ) $att['style'] .= 'width: '.$params['maxwidth'].'px;'; 100 if( !empty($params['height']) ) $att['style'] .= 'height: '.$params['height'].'px;'; 101 else if( !empty($params['maxheight']) ) $att['style'] .= 'height: '.$params['maxheight'].'px;'; 99 102 } else 100 103 $att['src'] = $cache_www; … … 131 134 case 'image/x-xpixmap' : $image = imagecreatefromxpm($origine_www); break; 132 135 default : return ; 136 } 137 138 if(!empty($array['maxwidth']) && !empty($array['maxheight'])) { 139 140 $rapy = imagesy($image)/$array['maxwidth']; 141 $rapx = imagesx($image)/$array['maxheight']; 142 143 if( $rapy > $rapx ) { 144 $array['height'] = $array['maxheight']; 145 $array['width'] = imagesx($image)/$rapy; 146 } else { 147 $array['width'] = $array['maxwidth']; 148 $array['height'] = imagesy($image)/$rapx; 149 } 133 150 } 134 151 … … 193 210 // Background 194 211 if( !empty($array['background']) ) { 212 $array['background'] = str_replace('#', '', $array['background']); 213 $rgb = array(0,0,0); 214 for ($x=0;$x<3;$x++) $rgb[$x] = hexdec(substr($array['background'],(2*$x),2)); 195 215 $fond = imagecreatetruecolor(imagesx($image), imagesy($image)); 196 imagefill( $fond, 0, 0, imagecolorallocate( $fond, 255, 255, 255) );216 imagefill( $fond, 0, 0, imagecolorallocate( $fond, $rgb[0], $rgb[1], $rgb[2]) ); 197 217 imagecopy( $fond, $image, 0, 0, 0, 0, imagesx($image), imagesy($image)); 198 218 $image = $fond;
