PHP Classes

PHP Image Mosaic Generator: Generate a mosaic from an image in PDF format

Recommend this page to a friend!
  Info   View files Example   Demos   Screenshots Screenshots   View files View files (11)   DownloadInstall with Composer Download .zip   Reputation   Support forum (4)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 70%Total: 670 All time: 4,814 This week: 90Up
Version License PHP version Categories
mosaic-pdf 1.2GNU General Publi...5PHP 5, Graphics, Files and Folders, P...
Description 

Author

This class can generate a mosaic from an image in PDF format.

It extends the FPDF class to create a document with a given size that renders a background image divided in tiles that overlay a set of several one images.

The tile images are overlayed with a given level of transparency as if they were glass tiles, so you can still recognize the background image behind the tile images.

The number of columns and rows of the tiles, the alpha transparency level and the tile images are configurable parameters.

The resulting PDF document is saved to a given file name.

Innovation Award
PHP Programming Innovation award nominee
April 2016
Number 3


Prize: One copy of the Zend Studio
Some applications need to present groups of images in an attractive way for their users.

One nice way to present images is to create a mosaic effect. Several images are displayed as tiles next to each other, so the users can see many images at once.

This PHP class can show tiled images using the mosaic effect. There is one main background image and all the group images are displayed over that image using transparency in a way that looks like small glasses over the background image, causing great visual impression.

The class can generate the mosaic effect in a PDF document that can be printed. Using the same algorithm it could eventually generate the same mosaic effect outputting as an image.

The package comes with a nice screenshot of the output so you can see the effect in practice.

Manuel Lemos
Picture of Luciano Salvino
  Performance   Level  
Name: Luciano Salvino <contact>
Classes: 11 packages by
Country: Argentina Argentina
Age: 51
All time rank: 134516 in Argentina Argentina
Week rank: 312 Up4 in Argentina Argentina Up
Innovation award
Innovation award
Nominee: 9x

Example

<?php

error_reporting
(E_ALL);
ini_set('display_errors', '1');

// call class
require('mosaic.php');

// define params
$arrImages = array(
   
'pdf' => 'origin/temp/example.pdf',
   
'temppath' => 'origin/temp/',
   
'background' => array(
       
'originpath' => 'origin/',
       
'file' => 'bg.jpg',
       
'alpha' => 55,
       
'ratio' => 72/25.4,
    ),
   
'images' => array(
       
'cols' => 15,
       
'rows' => 15,
       
'alpha' => 55,
       
'ratio' => 72/25.4,
       
'originpath' => 'origin/images/',
       
'files' => array(
           
'1.jpg',
           
'2.jpg',
           
'3.jpg',
           
'4.jpg',
           
'5.jpg',
        )
    ),
);

// initialize class
$pdf=new Mosaic( 'p', 'mm', array('210','297') );
$pdf->SetDisplayMode('fullpage');
$pdf->AddPage();

// define folder configuration
$pdf->setConfig($arrImages);

// gen mosaic
$pdf->createMosaic();





Details

MosaicPDF

MosaicPDF is a PHP class that create a image mosaic in PDF format. FPDF class extended

Usage


// call class
require('mosaic.php');

// define params
$arrImages = array(
	'pdf' => 'origin/temp/example.pdf',
	'temppath' => 'origin/temp/',
	'background' => array(
		'originpath' => 'origin/',
		'file' => 'bg.jpg',
		'alpha' => 45,
		'ratio' => 72/25.4,
	),
	'images' => array(
		'cols' => 10,
		'rows' => 15,
		'alpha' => 55,
		'ratio' => 72/25.4,
		'originpath' => 'origin/images/',
		'files' => array(
			'1.jpg',
			'2.jpg',
			'3.jpg',
			'4.jpg',
			'5.jpg',
		)
	),
);

// initialize class
$pdf=new Mosaic( 'p', 'mm', array('210','297') );
$pdf->SetDisplayMode('fullpage');
$pdf->AddPage();

// define folder configuration
$pdf->setConfig($arrImages);

// gen mosaic
$pdf->createMosaic();

  10000artistas.comExternal page  
Screenshots  
  • example
  • origin/temp/example.jpg
  Files folder image Files  
File Role Description
Files folder imageorigin (1 file, 2 directories)
Accessible without login Plain text file example.php Example example
Plain text file fpdf.php Class class
Plain text file mosaic.php Class extended class
Accessible without login Plain text file README.md Doc. Readme

  Files folder image Files  /  origin  
File Role Description
Files folder imageimages (5 files)
Files folder imagetemp (1 file)
  Accessible without login Image file bg.jpg Data background image

  Files folder image Files  /  origin  /  images  
File Role Description
  Accessible without login Image file 1.jpg Icon image example
  Accessible without login Image file 2.jpg Icon image example
  Accessible without login Image file 3.jpg Icon image example
  Accessible without login Image file 4.jpg Icon image example
  Accessible without login Image file 5.jpg Icon image example

  Files folder image Files  /  origin  /  temp  
File Role Description
  Accessible without login Plain text file example.pdf Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 92%
Total:670
This week:0
All time:4,814
This week:90Up
User Ratings User Comments (2)
 All time
Utility:87%StarStarStarStarStar
Consistency:93%StarStarStarStarStar
Documentation:93%StarStarStarStarStar
Examples:81%StarStarStarStarStar
Tests:-
Videos:-
Overall:70%StarStarStarStar
Rank:257
 
Congratulations, thats a very good class :-)
7 years ago (José Filipe Lopes Santos)
80%StarStarStarStarStar
The example does not work.
7 years ago (goodbee)
42%StarStarStar