<?php $nouvellelargeur=($x[0]X40)/$x[1];?>
<?php function dynamicCSS() { return "#d-image img {border: 0px solid #f2f2f2; margin: 9px 0px 0px 0px; } #d-thumbs { margin: 0px 0px 0px 0px;} #d-thumbs img {padding: 0; border: none; width:".$nouvellelargeur"; } #d-image { }; #text { margin-left: 1em; float: right; width: 200px; }"; } ?>
Comment faire pour obtenir des rectangles, qui même si leurs tailles n'est pas proportionnel à celles des photos d'origine permettant d'avoir des vignettes non déformées.
je ne cois pas que width:auto; soit valable...
* Returns array of file size * (natural dimensions) * * @param integer $maxwidth * @return array */ function resizing($maxwidth) { $width_percentage = $maxwidth / $this->size[0]; $height_percentage = $maxwidth / $this->size[1]; if (($this->size[0] > $maxwidth) || ($this->size[1] > $maxwidth)) { if ($width_percentage <= $height_percentage) { $this->new_size['w'] = round($width_percentage * $this->size[0]); $this->new_size['h'] = round($width_percentage * $this->size[1]); } else { $this->new_size['w'] = round($height_percentage * $this->size[0]); $this->new_size['h'] = round($height_percentage * $this->size[1]); } } else { // square images ? $this->new_size['w'] = $this->size[0]; $this->new_size['h'] = $this->size[1]; } } /** * Returns array of file size * (square thumbnails) * * @param void * @return array */ function sys_resize() { $this->sys_size['w'] = $this->size[0]; $this->sys_size['h'] = $this->size[1]; if ($this->sys_size['w'] > $this->sys_size['h']) { $this->offset['w'] = ($this->sys_size['w'] - $this->sys_size['h'])/2; $this->offset['h'] = 0; $this->sys_size['w'] = $this->sys_size['h']; } elseif ($this->sys_size['h'] > $this->sys_size['w']) { $this->offset['w'] = 0; $this->offset['h'] = ($this->sys_size['h'] - $this->sys_size['w'])/2; $this->sys_size['h'] = $this->sys_size['w']; } else { $this->offset['w'] = 0; $this->offset['h'] = 0; $this->sys_size['w'] = $this->sys_size['h']; } }
function sys_resize() { $this->sys_size['w'] = $this->size[0]; $this->sys_size['h'] = $this->size[1];
$this->sys_size['w'] = '35px'; // ta largeur en pixel $this->sys_size['h'] = '55px';// ta hauteur en pixel
#d-thumbs img {padding: 0; border: none; height: 55px; width: 35px ; }
Si mon bloc vignette n'est pas proportionnel à l'image, celle-ci doit être rognée et non déformée.
Mes connaissances en php sont très limitées,
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
Une autre solution en HTML/CSS un peu plus adaptée à ce cas là : tu met l'image en background d'un bloc à dimensions fixes.