With this extension you can create and display a thumbnail for a random image from a selected folder.
The extension contains 2 Server Behaviors, accessible at Server Behaviors' panel->Tecnorama->Advanced Random Thumbnails:
1.- "Primary Random Thumbnail" Use this Server Behavior to add the first thumbnail. Besides, you will be able to set the general properties that will apply to all the thumbnails. You should use it only once per page
2.- "Dependant Random Thumbnails": Use this Server Behavior if you want to add more thumbnails to your document.
Read them carefully: They will you show you some guidelines about the use and limitations of the extension.
Q.- Can I add more than one thumbnail to the same page?
Yes: to add more thumbnails to the page, use the "Dependant Random Thumbnail" Server Behavior instead of the "Primary Random Thumbnail" one, which should be used only the first time. Why?
Some parameters ("Add PopUp" and "Thumbnail Prefix") are shared by all the thumbnails. These params can be modified only in the "Primary" window and won't be available for modification by "dependant" thumbnails.
Use the "Primary" Server Behavior only (and at least) once. You can use the "Dependant" SB's as many times as you like (but remember that your server's resources will be affected)
Q.- Can I include subfolders to browse for images?
Yes. Activate the "Browse Subdirs" checkbox. This option is independent for every thumbnail: You can select images from just one folder for one thumbnail and include subfolders in the next one.
Q.- Can I create thumbnails with different widths from the same image ?
Yes. But it will affect system resources:
When the page is executed, it will check if a thumbnail for that image has already been created and if it has the same dimensions you have set. If it matches, the page will use the thumbnail instead of creating a new one (saving system resources).
However, if you're using more than one thumbnail and they use different dimensions, the page will have to create a new thumbnail and overwrite the old one.
Maybe, next versions will add the feature of storing thumbnails with different dimensions from the same original image.
Q.- Can I put a link to the original image?
Q.- Everytime the page loads, I get the following error:
Warning: imagejpeg: unable to open ‘your_file_path.jpg' for writing in ‘your_php_file_path’ on line (number)
Make sure that the folders where images are stored have write permissions, so the page can create the generated thumbnails in them. Every thumbnail is created in the same folder where the original image is stored.
Warning: fopen("fake_win.htm", "w") - Permission denied in ‘your_php_file_path’ on line (number)
The first time the page is executed it will try to create it. However, if the folder does not have write permissions, an error will be returned.
You've got 2 solutions for this:
1.- Give write permissions to the folder where the php page is located, at least for the first time the page is loaded (the page will only try to create "fake_win.htm" if it doesn't exist). After that, you can revert the folder to its former permissions.
2.- Create an empty file (without html tags or anything in it) called "fake_win.htm" in the same folder where the php page is located.
Q.- Which version of GD do I need?
The extension works both with 1.8.x and 2.0.x versions.
The extension has been successfully tested on:
Q.- Are gifs supported?
No, only jpeg files (*.jpg, *.jpeg). Due to patent restrictions, GD does not support *.gif files.
Q.- Can I choose the width and height of the generated thumbnail?
Only the width. The height will proportionally calculated. This has been done on purpose to avoid distorted thumbnails (it's a feature, not a bug).
Q.- If I can't choose the height, what is the "Height" texfield for?
It will help you to accomodate the image placeholder in design view, so you can see how thumbnails will suit your design (well, approximately).
Q.- What word should I use as prefix?
Choose a string that will be unique in the image's path. For example:
The prefix: "image" won't work with these paths: "images/img1.jpg" or "img/image3.jpg.
Another good reason to choose a good prefix is that, if you want to change it, you'll have to delete all the thumbnails that are using the old prefix!! You are warned about this.
Q.- I'm using the extension in more than one page: Can I use a different prefix in every page?
You could if every page is using images from different folders, but I encourage you not to do so!!
I'll say it again: choose an original prefix and keep tied to it.
You can see a demo here
Download current version (1.0.0)