Voilà comment je l'ai fait ...
J'utilise Paperclip à la taille d'une vignette d'image, dans ce cas, la taille minuscule est 128x128, ainsi que le grand poste de CSSBakery. J'ai également les images définies pour avoir un lien vers l'image originale.
http://www.cssbakery.com/2010/07/image-grid-using-css-floats_6950.html https://github.com/thoughtbot/paperclip
À mon avis:
<div id="gallery">
<ul id="grid">
<% @images.each do |image| %>
<li><%= link_to image_tag(image.photo.url(:tiny)), image %></li>
<% end %>
</ul>
</div>
Im mon app/assets/stylesheets fichier CSS (lire le post www.cssbakery.com sur la grille css)
/* ------------------------------------------
Grid
--------------------------------------------- */
ul#grid {
padding: 0;
list-style: none;
margin: 20px auto 0;
width: 700px;
}
#grid li {
float: left;
padding: 0;
margin: 0 5px 10px 5px;
}
#grid li a {
display: block;
}
#grid li img {
background-color: #64666a;
padding: 7px; margin: 0;
border: 1px dotted #58595b;
width: 128px;
height: 128px;
}
#grid li a:hover img {
opacity:0.3; filter:alpha(opacity=30);
}
.grid_display {
padding: 20px;
margin-left: auto; margin-right: auto; margin-top:50px; margin-bottom:0;
/*background-color: #ffd7ce;*/
width: 513px;
/*these two properties will be inherited by .grid_display h2 and .grid_display p */
font-family: 'GraublauWeb', arial, serif;
text-align: center;
}
div.grid_display h2 {
padding: 0; margin: 0;
clear: both;
font-size: 35px;
font-weight: normal;
color: #58595b;
background: none;
font-family: 'GraublauWeb', arial, serif;
/* reset for cascade effects that are trickling down from other h2's */
text-transform: none;
letter-spacing: normal;
}
.grid_display p {
margin:0; padding: 0;
font-size: 15px;
color: #58595b;
}
Qu'est-ce qui ne fonctionne pas exactement ou que voulez-vous savoir dans le détail? – polarblau
Merci plarblau, Ce que je veux est d'afficher une image dans un tableau par exemple comme ceci: 5 photos en largeur x 10 en hauteur. – benoitr