Ejemplo n.º 1
0
    $masonry->minHeight = 10;
    $masonry->maxHeight = 30;
    $masonry->fillTopProbability = 5;
    $masonry->fillHalfwayProbability = 2;
} else {
    $masonry->multiplier = 10;
    $masonry->ysize = 10;
    $masonry->minWidth = 1;
    $masonry->maxWidth = 4;
    $masonry->minHeight = 3;
    $masonry->maxHeight = 7;
}
// set xsize to allow for maximum width/height of all images
$masonry->xsize = count($images) * ($masonry->maxWidth / ($masonry->ysize / $masonry->maxHeight));
try {
    $position = $masonry->create($images);
} catch (Exception $e) {
    echo $e->getMessage();
}
foreach ($images as $k => $v) {
    ?>

		<div style='top: <?php 
    echo $position[$k]['y'];
    ?>
%; left: <?php 
    echo $position[$k]['x'];
    ?>
%; width: <?php 
    echo $position[$k]['w'];
    ?>