Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Website Design Forum


You are currently viewing our Website Design Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 08-17-2005, 06:33 AM I need a gallery
tonya's Avatar
Ultra Talker

Posts: 485
Location: world traveller based in UK
Trades: 0
I need to create a gallery for a ccustomer.
I cant work out how best to do it so they can quickly upload the pics & get the gallery running.
I have some gallery code in asp & can deliver the gallery in various categories etc etc but that means lots of entries into a database which is time consuming when they have stacks of pics every week.
Is an automatic program better ? & if so can anyone recommend a good one or has anyone got any other ideas ?
__________________
Tonya

::
Please login or register to view this content. Registration is FREE
::
Please login or register to view this content. Registration is FREE
tonya is offline
Reply With Quote
View Public Profile Visit tonya's homepage!
 
 
Register now for full access!
Old 08-17-2005, 08:46 AM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
I created a gallery in ASP.NET by which all you need to do is put the image in a folder (and use sub folders as categories) and it will pick it up & generate the thumbnail for you.

This gets the files and puts them in a Repeater control:

Code:
<%@ Page Language="VB" Debug="True" %>
<%@ Import Namespace="System.IO" %>

<script runat="server">

	Dim IsIE As Boolean

	Sub Page_Load
		Dim dirInfo as New DirectoryInfo(Server.MapPath("/images/gallery/" & Request.QueryString("category") & "/"))
    
		repGallery.DataSource = dirInfo.GetFiles("*.jpg")
		repGallery.DataBind()

		If Request.Browser.Browser.ToString() = "IE" Then
			IsIE = True
		Else
			IsIE = False
		End If
	End Sub

</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title></title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<style type="text/css">
			div#Images {
			}
			div.Thumb {
				border: 1px solid blue;
				float: left;
				margin: 5px;
				padding: 3px;
			}
		</style>
	</head>

	<body>
		<form runat="server">
			<div id="Body">
				<h1><%= Request.QueryString("category") %></h1>
				<p class="Content">Click and image thumbnail to enlarge</p>
				<div id="Images">
					<div class="Spacer"></div>
					<% If IsIE Then Response.Write("<div style=""width: 1px; height: 236px; float: right;""></div>") %>
					<asp:Repeater id="repGallery" runat="server">
						<ItemTemplate>
							<div class="Thumb"><a href="/images/gallery/<%= Request.QueryString("category") %>/<%# DataBinder.Eval(Container.DataItem, "Name") %>" title="<%# Left(DataBinder.Eval(Container.DataItem, "Name"), Len(DataBinder.Eval(Container.DataItem, "Name")) - 4) %>"><img src="/controls/thumbnail.aspx?filename=/images/gallery/<%= Request.QueryString("category") %>/<%# DataBinder.Eval(Container.DataItem, "Name") %>&width=100" alt="<%# DataBinder.Eval(Container.DataItem, "Name") %>" /></a></div>
						</ItemTemplate>
					</asp:Repeater>
					<div class="Spacer"></div>
				</div>
			</div>

		</form>
	</body>
</html>

And here's thumbnail.aspx, which generates the thumbnail of the image on the fly...
Code:
<%@ Import Namespace="System.Drawing" %>
<script runat="server">
	Dim objImage, objThumbnail As System.Drawing.Image
	Dim strFilename As String
	Dim shtWidth, shtHeight As Short     

	Sub Page_Load
		strFilename = Server.MapPath(Request.QueryString("filename"))

		Try
			objImage = objImage.FromFile(strFilename)
		Catch
			objImage = objImage.FromFile(Server.MapPath("/images/error.gif"))
		End Try

		If Request.QueryString("width") = Nothing Then
			shtHeight = objImage.Height
		ElseIf Request.QueryString("width") < 1 Then
			shtHeight = 100
		Else
			shtHeight = Request.QueryString("width")
		End If

		shtWidth = objImage.Width / (objImage.Height / shtHeight)

		objThumbnail = objImage.GetThumbnailImage(shtWidth, shtHeight, Nothing, System.IntPtr.Zero)
		Response.ContentType = "image/jpeg"
		objThumbnail.Save(Response.OutputStream, Imaging.ImageFormat.Jpeg)

		objImage.Dispose()
		objThumbnail.Dispose()
	End Sub
</script>
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 08-17-2005, 09:09 AM thanks
tonya's Avatar
Ultra Talker

Posts: 485
Location: world traveller based in UK
Trades: 0
Thats great thanks
Do I need any additional codes, tools or files on my server to make the asp.net code work ?
& do you have a working example I can look at to help me get my head around .
Tonya
__________________
Tonya

::
Please login or register to view this content. Registration is FREE
::
Please login or register to view this content. Registration is FREE
tonya is offline
Reply With Quote
View Public Profile Visit tonya's homepage!
 
Old 08-17-2005, 10:48 AM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
No, sorry I don't have an online working example...

The only thing you need on your server to run ASP.NET is the .NET Framework. If you are running your own server, you can download it from Microsoft:
http://www.microsoft.com/downloads/d...displaylang=en

Otherwise, check with your host.
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Reply     « Reply to I need a gallery
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13849 seconds with 12 queries