Introduction
This application is useful to generate in few minutes an HTML photogallery from several source images.
You can also insert text over enlarged images semi-transparently, defining its position, size, shadow, and optionally with a background shape like a rectangle or an ellipse and a 3D effect.
Moreover you can impress a watermark image on the target enlarged images defining the transparency key, the size in percentage of the target image, the transparency level, and the position.
You can use masks to add corners and shapes to images (thumbnails and/or enlarged).
You can convert images between formats.
Finally, you can make an interesting shadow effect like a picture over a colored or blank sheet picking colors from page templates or other sources.
The pages are generated using HTML templates customizable by the user.
Several formats are supported: JPG (with customizable compression level), GIF, PNG, WMF, TIFF, EXIT and ICO.
The tool has a nice look and a user friendly interface.
The application is fully extensible using DLL plugins to have different HTML styles.
Background
This application extends "batch image" project presented in my previous article.
The target use of "extended Web gallery" is different than "batch image": while "batch image" is useful for creating images in batch, with "extended Web gallery" you can create an HTML photo gallery using various styles.
HTML Styles using Plugins
The HTML generation is plugin based. Anyone can write your own plugin to have a fully custom photo gallery style.
Actually I've implemented three base plugins that have the following layouts: standard table, horizontal autoscroll frame and vertical autoscroll frame.
The plugins have to implement the following interface (IPlugins
):
public interface IPlugin
{
event EventHandler FinishWork;
System.Windows.Forms.UserControl GetPluginInterface();
string Name { get; }
string Description { get; }
Bitmap sample { get;}
object Action(object data);
void ThreadOperate(CParams.ThreadOperation operation);
void SetParameters(List<CPARAMS> paramlist);
void SetMainTemplate(List<STRING> before, List<STRING> after);
void SetPagesTemplate(List<STRING>before, List<STRING> after);
void SetDirs(string outputpath, string imagepath,
string thumbnailspath, string pagespath, string pagesextension);
void Serialize(Stream myStream, ref IFormatter formatter);
void DeSerialize(Stream myStream, ref IFormatter formatter);
}
When the application starts, the plugin manager (Plugger
) checks the presence of the plugins in the "Plugins" directory:
private void LoadPluginsFromAssemly(System.Reflection.Assembly assembly)
{
Type[] types = assembly.GetTypes();
foreach (Type type in types)
{
if (type.IsPublic && !type.IsAbstract)
{
Type typeInterface = type.GetInterface("IPlugin", true);
if (typeInterface != null)
{
ListItem listitem = new ListItem();
listitem.plugin = Activator.CreateInstance(type) as IPlugin;
listitem.filename = type.Module.ToString();
if (listitem.plugin == null)
continue;
listitem.plugin.FinishWork += new EventHandler(plugin_Evento);
PluginList.Add(listitem);
}
}
}
}
Thanks to jonnynolimits for the precious support for plugin reading.
Using Masks
You can use masks to obtain cool image effects. A mask is a common image that is put over the original. Obviously, you can define a transparency key.
So, this is the result (using horizontal frame plugin) that is like a film.
You can quickly create new mask images using several shapes or sources.
Demo Galleries
Standard table
Horizontal frame
Vertical frame
External Links
I'm going to write some user documentation. Follow this link (actually I'm working on writing a user guide).
Notes
Please report bugs!