Support => cpg1.4 plugins => cpg1.4.x Support => Older/other versions => cpg1.4 plugin contributions => Topic started by: Stramm on July 08, 2008, 07:08:12 pm

Title: Mosaic
Post by: Stramm on July 08, 2008, 07:08:12 pm
This plugin lets you create a photomosaic ( ). It uses the google library phpmosaic ( ).

This plugin is very resource hungry. Therefore you can override memory_limit and timeout (if you don't make use of the safe mode).

How to get started:
1. Install the plugin.
2. Check settings and modify them to your needs
3. Build an index (needs some time, depending on your server - you may want to do that album by album - if you've created an index for a pic, then you'll have to clear the entire index db [click clear], to remove it. If an index already exists for an image, creating the indexes again for that album would skip this image)
Try to have as many indexed images as possible for the best result.
Try to have pics with different colors (also extremes)
4. In the intermediate view below the pic you'll see a 'Build mosaic button' - click it and the process starts (may take its time). When finished, the button gets replaced with a download link

Click the mosaic button in the admin menu to go to the mosaic config menu
- Enable mosaic: ( function disabled atm cause of the next setting)
- Only admin can create mosaics: if you want your users not to take heat on your box
- Resize option: when creating the thumbs to be used for the mosaic, the get resized. Here you can set how this has to be done... options - cut   |  ignore  |   deform
- Thumbnail width: width of the thumb to be used for the mosaic
- Thumbnail height: height of the thumb to be used for the mosaic
- Time Limit in seconds (0 = unlimited) (only if safemode = off) : default 0
- Memory Limit in Megabyte, auto doesn't change the default set by php.ini (only if safemode = off): 'auto' as siad uses the php.ini setting, use eg. 8, 16, 32, 64, 128... 512 etc. depending on your server
- Thumbnail limit for mosaic image creation process (0 = unlimited) maximum number of thumbnails in mosaic-image: default 7500; if you set the other options to high, this may not be enough thumbs and you need to increase it (but then you need more memory, too)
- How many pixel together get replaced by a thumb (0 = auto calculation): auto calc makes 32 thumbs fit in the source images width. The lower you set this, the more thumbs you need (better result, but a lot more CPU + mem is needed)
- Distance same thumbs must have at minimum (0 = each thumb only once per image): This number sets the distance the same thumbs must have in x,y. If you set it eg. to 4, then the same thumbs have at least 4 other images between them in x and y dimension. If you do not have that much indexed images, then it may be good, to set this to 1
- Jpeg quality of the mosaic image : That's of course the quality used to save the final image

[Edit GauGau 2010-03-05]
This plugin has been added to the subversion repository:

It has been updated as well to reflect the version checking routines in the plugin manager that are meant to make sure that galleries don't break because of plugins installed that aren't meant for that particular version of the gallery.

Title: Re: Mosaic
Post by: Stramm on July 09, 2008, 09:17:15 am
Here a sample result
Title: Re: Mosaic
Post by: Pascal YAP on July 09, 2008, 10:15:19 am
WoW Cool  ;D

Here is an other sample  ;)
Do you remenber this old Avatar in this example  :) ?
Title: Re: Mosaic
Post by: Toddsc on January 20, 2010, 08:29:54 am
is this working on 1.4.25?  I get this error:

Parse error: syntax error, unexpected T_CLASS in /home/nwjpb02/public_html/photos/plugins/mosaic/mosaic_include.php on line 12

Also, the instructions have say to build an index, is that an option when you click Mosaic normally?


Title: Re: Mosaic
Post by: Joachim Müller on January 20, 2010, 08:42:42 am
If you get a parse error your file got corrupt. Get a fresh copy. Extract it properly. Make sure not to use any editors that are not designed to edit PHP files. Do as suggested per board rules (,55415.msg270616.html#msg270616)!
Title: Re: Mosaic
Post by: Toddsc on January 20, 2010, 08:48:05 am
PHP 5 was disabled on my server, sorry, it's working now.  :)
Title: Re: Mosaic
Post by: Joachim Müller on January 20, 2010, 09:01:15 am
@Stramm: does this plugin require PHP 5? Does it not work with PHP 4?
Title: Re: Mosaic
Post by: Stramm on January 20, 2010, 09:30:32 am
Yes, the mosaic class requires PHP 5.
Title: Re: Mosaic
Post by: tinorebel on March 20, 2010, 02:08:17 pm
I just tryed this plug in on my gallery and I'm really Impressed.
Working fine from the first try. :D

I have a gallery with 1000 images all vertical and the final effect is great!
I have images of 600 pix, so I have setted mosaic to use a thumb each 10 pixels: meaning the mosaic comes out from a 60 x 90 matrix with 5400 thumbs!

Can take a look if you like here:

Is there a way to reduce the size of the mosaic download?
Or is there a way I can allow to build and download only registred users?

Thanks! :)