2017 © Pedro Peláez
 

library fluid-gallery

Arrange Images with percentages

image

clippings/fluid-gallery

Arrange Images with percentages

  • Wednesday, August 9, 2017
  • by hkdobrev
  • Repository
  • 12 Watchers
  • 2 Stars
  • 33,836 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 15 % Grown

The README.md

Fluid Gallery

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version, (*1)

Arrange Images with percentages, (*2)

Installation

Install via composer, (*3)

composer require clippings/fluid-gallery

Usage

Conseptually, you pile images (or videos) into a ItemGroup and then line by line extract using custom sizing logic., (*4)

$gallery = new ItemGroup([
    new Item(100, 200, 'http://example.com/1.jpg'),
    new Item(200, 100, 'http://example.com/2.jpg'),
    new Item(100, 100, 'http://example.com/3.jpg'),
    new Item(300, 200, ['url' => 'http://example.com/video.mov', 'type' => 'video']),
]);

$gallery->setMargin(15);

// extract some of the images into another group
$group = $gallery->extract(function ($group) {

    // The returned items are removed from the parent gallery
    return $group
        // get only images with text urls
        ->filter(function (Item $item) {
            return is_string($item->getContent());
        })
        // set the hight of all the images to 50, preserving the aspect ratios
        ->setHeight(50)
        // Get a slice of the images, arranged horizontally, no wider than 200 pixels
        ->horizontalSlice(200)
        // Scale horizontally arranged images to exactly 200, keeping aspect ratios
        ->scaleToWidth(200);
});

foreach ($group as $item) {
    echo $item->getContent();
}

// Get the remaining items
echo $gallery[0]->getContent()['url'];

License

Copyright (c) 2015, Clippings Ltd. Developed by Ivan Kerin, (*5)

Under BSD-3-Clause license, read LICENSE file., (*6)

The Versions

09/08 2017

dev-master

9999999-dev

Arrange Images with percentages

  Sources   Download

BSD-3-Clause

The Requires

  • php ^7

 

The Development Requires

04/03 2017

0.3.1

0.3.1.0

Arrange Images with percentages

  Sources   Download

BSD-3-Clause

15/06 2015

0.3.0

0.3.0.0

Arrange Images with percentages

  Sources   Download

BSD-3-Clause

12/06 2015

0.2.2

0.2.2.0

Arrange Images with percentages

  Sources   Download

BSD-3-Clause

12/06 2015

0.2.1

0.2.1.0

Arrange Images with percentages

  Sources   Download

BSD-3-Clause

12/06 2015

0.2.0

0.2.0.0

Arrange Images with percentages

  Sources   Download

BSD-3-Clause

11/06 2015

0.1.0

0.1.0.0

Arrange Images with percentages

  Sources   Download

BSD-3-Clause