Changeset 65886 in spip-zone
- Timestamp:
- Sep 15, 2012, 9:29:00 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
_dev_/images_a2x/inc/filtres_images_lib_mini.php
r65885 r65886 720 720 } 721 721 722 // reduction d'image a la taille voulue, le nombre de px pouvant dependre 723 // d'un facteur @2x pour les ecrans haute definition 722 724 // http://doc.spip.org/@process_image_reduire 723 725 function process_image_reduire($fonction,$img,$taille,$taille_y,$force,$cherche_image,$process){ 726 $a2x = 2; # todo : gerer ca en define() ou en reglage, ou autre 727 728 $img = process_image_reduire_a1x($fonction,$img,$a2x *$taille,$a2x *$taille_y,$force,$cherche_image,$process); 729 730 if ($a2x != 1) { 731 $w = extraire_attribut($img, 'width'); 732 $h = extraire_attribut($img, 'height'); 733 list($rw,$rh) = _image_ratio($w, $h, $taille, $taille_y); 734 735 if ($w>$rw OR $h>$rh) { 736 $img = inserer_attribut($img, 'width', $rw); 737 $img = inserer_attribut($img, 'height', $rh); 738 739 # todo : a transformer en |ajouter_style{} 740 $style = extraire_attribut($img, 'style'); 741 $style = preg_replace(',\b(width|height)\s*:\s*\d+px\s*;?', 742 '', extraire_attribut($img, 'style')); 743 $img = inserer_attribut($img, 'style', 744 trim( 745 "border:3px solid green;". // debug 746 "width:${rw}px;height:${rh}px;".$style)); 747 748 # todo : a transformer en |ajouter_classe{} 749 $img = inserer_attribut($img, 'class', trim("a2x ".preg_replace(',\b\s*a2x\s*\b,', ' ', extraire_attribut($img, 'class')))); 750 } 751 } 752 753 return $img; 754 } 755 756 // reduction d'image a la taille voulue en px 757 // http://doc.spip.org/@process_image_reduire_a1x 758 function process_image_reduire_a1x($fonction,$img,$taille,$taille_y,$force,$cherche_image,$process){ 724 759 $image = false; 725 760 if (($process == 'AUTO') AND isset($GLOBALS['meta']['image_process']))
Note: See TracChangeset
for help on using the changeset viewer.