Creating thumbnails dynamically using ASP

This page shows 4 photographs in JPG format. The views shown below have been dynamically resized using csImageFile. Clicking on each image will link to the full size JPEG image.

This technique of displaying smaller versions of images gives the developer a great deal of flexibility, especially when working with a large picture collection. It is not necessary to produce an individual thumbnail for each image in advance.

This page is simple and contains no important scripting. Each <img> tag points to another script which calls csImageFile, resizes the JPG and streams it using BinaryWrite. The name of each image is passed in the URL, as shown below.

Example:

<img src="showthumb.asp?JpegName=scarborough1">

Click Here for the listing and description of "showthumb.asp", the script that produces each image.

For interest the photographs are all taken in Scarborough, North Yorkshire. They are our own photographs so you can copy them if you like.

function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function eraseCookie(name) { createCookie(name,"",-1); } function AcceptCookies() { createCookie("cookie-site","true",120); createCookie("cookie-tracking","true",120); createCookie("cookie-remarketing","true",120); document.getElementById("overlay").style.display = "none"; } ]]>

Cookies

This site uses cookies for functionality, traffic analysis and for targeted advertising. Click the Accept button to accept our Cookie Policy. The Cookie Policy page offers configuration for a reduced set of cookies for this site.