Click here to Skip to main content
12,813,994 members (32,604 online)
Click here to Skip to main content
Add your own
alternative version


18 bookmarked
Posted 19 Jul 2010

Add .NET thumbnailing to a classic ASP Multi-upload image gallery

, 9 May 2014 CDDL
Rate this:
Please Sign up or sign in to vote.
Part II of an article describing an ASP based multi-image uploading tool. We add a .NET thumbnailer and free ourselves from the DLL registration for image manipulation.


In my original article, I explained the methodology for creating an asynchronous upload mechanism for images, along with a full featured image gallery manager that displayed the galleries using SimpleViewer, a flexible freeware Flash image gallery. While functional, the original solution had a serious limitation for widespread use: it relied on on a DLL for image manipulation. This precludes the solution from deployment on most hosting solutions, because most hosts don't allow you to register DLLs unless you have a virtual or dedicated server.

This article explains how to remove that restriction using .NET. Most hosting providers allow you to use both .NET and classic ASP in their Windows Server packages. So this solution should be more "hosting friendly". The thumbnailer I setup can be found in thumbnail.aspx.


I'll focus on the changes I made to the original code so this part won't be nearly as lengthy as it was in the original article.

The call to .NET was very simple to alter. Let's take a glossed over look at the original flow.

In the original code, the upload module handles the file upload and the thumbnailing. To split out the thumbnailing, add two new steps to the flow. One that makes a call to the .NET thumbnailer, and one that reads the return JSON and reacts. The revised flow looks like this:

The Code

Read the first article ("Classic ASP Multi Upload image Gallery") for a description of the full functionality of the upload tools. I'll focus on the changes you need to make.

Changes to upload_files.js

In the original code, each time an image is uploaded, the IFrame makes a call to the function uploadDone2() on the parent (top) page and passes the return JSON as a parameter. I renamed the old uploadDone2() to thumbnailDone(), and created a new uploadDone2 as follows:

// File is uploaded, read JSON and use it to call the thumbnailer
function uploadDone2(ret) {
    var data = eval("("+ret+")"); // Read the return values from the iframe
    if (!data.failure) {
        var url="";
        // Assemble URL to make thumbnail.aspx call
        url += "thumbnail.aspx";
        url += "?gallery_id=" + gallery_id;
        url += "&size=" + data.size;
        url += "&file=" + data.file_name;
        //now set our IFrame target to the thumbnail page
        $("upload_target").src = url;
    else if (data.failure) { //Upload failed - show user the reason.
  alert("Upload Failed: " + data.failure);
        $("uploaded_image0" + upload_counter).src = "nosign.gif";

That's it! Our Thumbnail.aspx page is already coded to call thumbnailDone() when it completes. Here's what the code looks like:

<script type='text/javascript'>
function init() {
   if ( top.thumbnailDone )
       top.thumbnailDone( document.getElementsByTagName("body")[0].innerHTML );  



And here is the complete thumbnail.aspx page code:

<%@ Page Language="vb" Debug="false" Trace="false" %>
<%@ import Namespace="System.Data" %>

Please take the time to vote and comment on this article. Thanks.

Version History

07/19/2010 - Original File

05/09/2014 - Fixed a bug in the gallery info editor.


This article, along with any associated source code and files, is licensed under The Common Development and Distribution License (CDDL)


About the Author

Larry Boeldt
Software Developer (Senior)
United States United States
I've been in development since the late eighties. Although I've picked up many languages over the years and will likely pick up many more I have been a Microsoft BASIC programmer the whole time. Back in the early days it was on a Color Computer 3 writing articles for an enthusiast's magazine and developing solutions for color computer users. Now it is C#, VB.NET and (still) VBScript with all the fixins (ADO,XML,JSON,SQL etc...). Around 1996 I decided the internet was the way to go and dedicated myself to web development. I've been doing it ever since.

Two of my favorite projects are working for a little company called Nigrelli Systems and working with a team of brilliant Engineers to develop fully automated packaging systems for the food and beverage industry. The second is working on a "Burn Room" Nemschoff Chairs, again I was blessed with a team of people who knew their stuff. The burn room remains unique to this day because there are only a handfull of certified rooms in the US.

Bears, Beats, Battlestar Galactica

You may also be interested in...

Comments and Discussions

QuestionVersion in HTML5 ? Pin
Member 121032431-Nov-15 2:31
memberMember 121032431-Nov-15 2:31 
AnswerRe: Version in HTML5 ? Pin
Larry Boeldt3-Nov-15 5:53
memberLarry Boeldt3-Nov-15 5:53 
GeneralRe: Version in HTML5 ? Pin
Member 121032433-Nov-15 11:02
memberMember 121032433-Nov-15 11:02 
QuestionChanging the limit from 10 to 25. Is this possible/advisable? Pin
SayItAintSo2-May-13 13:22
memberSayItAintSo2-May-13 13:22 
AnswerRe: Changing the limit from 10 to 25. Is this possible/advisable? Pin
Larry Boeldt8-May-13 16:22
memberLarry Boeldt8-May-13 16:22 
AnswerRe: Changing the limit from 10 to 25. Is this possible/advisable? Pin
Larry Boeldt20-May-13 18:09
memberLarry Boeldt20-May-13 18:09 
GeneralMy vote of 5 Pin
HenryUH11-Mar-13 4:56
memberHenryUH11-Mar-13 4:56 
QuestionUsing the latest .NET version Pin
HenryUH11-Mar-13 4:51
memberHenryUH11-Mar-13 4:51 
AnswerRe: Using the latest .NET version Pin
Larry Boeldt11-Mar-13 15:47
memberLarry Boeldt11-Mar-13 15:47 
QuestionSome minor issues Pin
waxed20-May-12 7:51
memberwaxed20-May-12 7:51 
AnswerRe: Some minor issues Pin
Larry Boeldt21-May-12 19:33
memberLarry Boeldt21-May-12 19:33 
AnswerRe: Some minor issues Pin
Larry Boeldt29-May-12 19:48
memberLarry Boeldt29-May-12 19:48 
GeneralEdit Gallery Error -- Object Expected Pin
Quintin Keilloh11-Feb-12 23:46
memberQuintin Keilloh11-Feb-12 23:46 
GeneralRe: Edit Gallery Error -- Object Expected Pin
Larry Boeldt15-Feb-12 18:55
memberLarry Boeldt15-Feb-12 18:55 
QuestionError on line 136 - thumbnail.aspx Pin
Member 810356522-Jul-11 21:20
memberMember 810356522-Jul-11 21:20 
AnswerRe: Error on line 136 - thumbnail.aspx Pin
Larry Boeldt25-Jul-11 19:46
memberLarry Boeldt25-Jul-11 19:46 
AnswerRe: Error on line 136 - thumbnail.aspx Pin
Larry Boeldt25-Jul-11 19:46
memberLarry Boeldt25-Jul-11 19:46 
GeneralRe: Error on line 136 - thumbnail.aspx Pin
Member 810356526-Jul-11 18:15
memberMember 810356526-Jul-11 18:15 
Thank you Larry, I will try that. Thanks again!
GeneralRe: Error on line 136 - thumbnail.aspx Pin
Member 810356526-Jul-11 23:25
memberMember 810356526-Jul-11 23:25 
QuestionDeploying Issue Pin
JBWills.7615-Jul-11 18:49
memberJBWills.7615-Jul-11 18:49 
AnswerRe: Deploying Issue Pin
Member 810356522-Jul-11 21:09
memberMember 810356522-Jul-11 21:09 
AnswerRe: Deploying Issue Pin
Larry Boeldt25-Jul-11 20:00
memberLarry Boeldt25-Jul-11 20:00 

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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170308.1 | Last Updated 9 May 2014
Article Copyright 2010 by Larry Boeldt
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid