PHP Classes
elePHPant
Icontem

Web montage: Generate a montage of random pictures from the Web

Recommend this page to a friend!
  Info   Screenshots Screenshots   View files View files (10)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2007-12-29 (8 years ago) RSS 2.0 feedNot yet rated by the usersTotal: 592 All time: 4,990 This week: 890Up
Version License PHP version Categories
webmontage 1.0.0GNU General Publi...5.0HTML, Graphics, Web services
Description Author

This class can be used to generate a montage of random pictures from the Web.

It accesses the Google image search site and performs a search with random words picked from a dictionary file.

The class retrieves the images and copy them to random positions in the montage image.

The montage image can be updated with new images after a given time interval.

It can also generate an HTML image map to associate each image in the montage with the respective words used in the search and the original images URLs.

Innovation Award
PHP Programming Innovation award nominee
January 2008
Number 6


Prize: One book of choice by Packt
Images are used often by Web sites to capture the attention of the users.

This class implements a neat solution to generate and display montages of images in Web site pages related to given topics.

It uses Google image search to search for given keywords and retrieves some images to generate a montage.

Manuel Lemos
Picture of R.L. Renkema
Name: R.L. Renkema <contact>
Classes: 2 packages by
Country: Portugal Portugal
Innovation award
Innovation award
Nominee: 1x

Details
Welcome to the wonderfull and colorfull world of webmontage.

Introduction.
Webmontage is a program very much inspired by WebCollage of Jamie Zawinski
http://www.jwz.org/webcollage/ who I greatly admire for his achievement. 
Webmontage is a complete new program based on the same idea but with 
IMHO more potential to give the user the fun (s)he is looking for and better
multiplatform support through the use of php instead of perl.

So what does it do?
It rips images of the web to do things with them. Currently it can create an
ever changing image with pictures on it linked and the searchterm annotated
or change your desktops background. Just like Jamie's webmontage it is
probably illegal to use in some countries as it cannot distinguish between
copyrighted or free to use imagery. So be warned you have to contemplate
very carrefully how to use it's output. f.i. you might consider:

- Producing wallpaper archieves
- Producing clipart archives
- Research and detect certain imagery

Though the latter might be in term with the law the primery certainly ar NOT.

Wallpapers.
You can use webmontage to find wallpapers on the internet, have them
optionally framed and displayed on your desktop. You can keep the
original picture or throw them out after creating your desktop.
Actually this is only a spinoff of:

Random image montage generation.
Which is IMHO much more intresting. webmontage will find images
of your choice defined by a searchitem list and place them randomy on
a canvas defined by you. It will at the same time generate a imagemap
that will make it possible to click on the canvas to trace where the origi-
nal picture came from. It also annotates the seachterm that was used.

Wheres the fun?
The program comes with examples on how to use it but I would like
to point out that one of the nice things are the searchterm lists.
If you look in the archive you will find a list that is build to create a
random canvas with the tv series Lost as topic. (No I do not watch it,
but luckely for you my family does giving me time to write this app).
You might create such lists and exchange them with your friend.
How good are your search terms can you avoid off-topic images???

What do you need?
webmontage should run on pretty much any system that has 
php5 installed 
with it's basic modules like
curl - to retrieve urls and images
gd - to handle the images

Then ofcouse it would be nice if you know how to use it, if not,
hopefully the two examples randpic.php and rndwallpaper.php
will be enough to get you started the first should run out of
the box, the second one might need edditing the commandline.

How do you work it?
Well if the previous didn't put you of let me surprise you with a
very flexible and simple engine to have hours of geek fun with.

The main class.
Webmontage exists of a single class 

webmontage

with the following callable
methods:

cycle()          - the montage engine.
wallpaper()   - yes the wallpaper engine.

these take some variable to play with their defaults are shown:

name of the html file that can be loaded in your browser to
see and examine the cycle canvas
	$object->htmlfile="canvas.html";

optional directory where to store pictures. It's up to you to
make sure it exists
	$object->picturedir = "";

search term list to use, you may place remarks at the start of the file
by preceding the lines with // like for php remarks. These lines will be 
dropped untill the first line without //
	$object->dictionary = "/usr/share/dict/words";

picture size google uses currently choose 0-6
	$object->gsize = 2;

Google pages to search from, the more and better your terms the less pages 
you will need to get a nice result
	$object->gpages = 10;

Google safety signal to prevent 'nasty' pics.
	$object->gsafe = 'off';

Canvas name, very important for both methods
	$object->cvsname = "canvas.jpg";

Temporary store for the image map, might aswell leave that default unless
your planning to use it somehow
	$object->cvsmap = "canvasmap.html";
	
An optinally border can be given. It should be a transparent gif that will be
resised automagically and projected on the canvas if this is set.
	$object->cvsbordergif;
	
How many images should we track on map?	
	$object->cvsmapmax = 50;
	
Canvas width	
	$object->cvswidth = 800;
	
Canvas height
	$object->cvsheight = 600;
	

Should we keep the original picture?
	$object->keeppic = false;
	
The refresh rate for the html file
	$object->refresh = 5;
	
How often should we cycle?	
	$object->cyclecount = 1;

How long to pause for the next cycle, this starts after the cycle has
finished so the processing time is not counted.
	$object->cyclewait = 5;

Should we start with a clean canvas and map?
	$object->restart = false;

This is a tricky one, it's used/needed for the wallpaper to place it, the routine will 
look for %image% in the command line and replace that with the canvas
name before executing.
	$object->cmdline;
	
Feedback.
Would very much be appreciated. Send me your favorite searchlist aswell, I 
intend to add it to a user searchlist directory. Send all you got including
bug reports, feature request but excluding spam or request to exclude
your image (this program has no images) to:

Raphael <cabal@sapo.pt> So ingles, faz a favor.

Release notes:
    
    Copyright 2007 "R.L. Renkema"
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

Screenshots  
  • canvas.jpg
  Files folder image Files  
File Role Description
Files folder imageborders (2 files)
Files folder imagelists (3 files)
Plain text file class.webmontage.php Class The main class
Plain text file randpic.php Example random picture gen
Plain text file rndwallpaper.php Example wallpaper setter
Plain text file gpl-3.0.txt Lic. license
Plain text file README Doc. it all in the name

  Files folder image Files  /  borders  
File Role Description
  Image file border.gif Data normal border
  Image file borderwp.gif Data border for wallpapers

  Files folder image Files  /  lists  
File Role Description
  Plain text file hentai.lst Data hentai search list
  Plain text file lost.lst Data lost tv search list
  Plain text file wallpaper.lst Data wallpaper search list

 Version Control Unique User Downloads Download Rankings  
 0%
Total:592
This week:0
All time:4,990
This week:890Up