Click here to Skip to main content
15,885,985 members
Articles / Programming Languages / C#
Article

An Application to Create Interesting and Fully Customizable Web Photo Gallery

Rate me:
Please Sign up or sign in to vote.
4.47/5 (16 votes)
4 Apr 2007LGPL32 min read 55.8K   4.6K   81   2
An application to create interesting and fully customizable Web photo gallery using plugins for generating pages
Image 1

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):

C#
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:

C#
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.

Image 2

So, this is the result (using horizontal frame plugin) that is like a film.

Image 3

You can quickly create new mask images using several shapes or sources.

Demo Galleries

Image 4

Standard table

Image 5

Horizontal frame

Image 6

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!

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


Written By
Web Developer
Italy Italy
I'm an electronic engeneer form Genoa.
I like very much dotnet and C#. I've developed some works like an html gallery generator, a graphic formula viewer (user defined), a webcam grabber and html gallery generator, a little framework for image processing, an image resizer, elaboration in batch and some other application tool.
Actually I'm working in VC++ 6 MFC, but I hope that my future is .net !!!
Some of my works are downloadable at:
http://www.solchiere.it
Lorenzo Banderali

Comments and Discussions

 
QuestionLol Pin
kkoukakis15-Sep-12 21:55
kkoukakis15-Sep-12 21:55 
Generaldude you didnt even comment plugin interface :)...im no mind reader Pin
Member 26397193-Jul-09 10:57
Member 26397193-Jul-09 10:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.