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.

HTML Forum


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



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Old 01-04-2006, 04:58 PM script?
tammyhart's Avatar
Extreme Talker

Posts: 212
Location: Birmingham, AL
Trades: 0
I'm not sure what kind of code this would be written in, so I'm asking in here. I want something that will load images automatically from a folder, so that when I want to add new images, all I have to do is upload them to that folder. I want it to show thumbnails and then open the actual image when clicked. Is this somewhere out there, or am i asking too much??
__________________
Tammy Hart

Please login or register to view this content. Registration is FREE

Last edited by tammyhart; 01-04-2006 at 05:00 PM..
tammyhart is offline
Reply With Quote
View Public Profile Visit tammyhart's homepage!
 
 
Register now for full access!
Old 01-04-2006, 05:22 PM
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
Sure it's possiible. What does your server support... I have ones written here in both ASP and PHP.
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 01-04-2006, 05:27 PM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
I wrote exactly that in ASP.NET (take a look at http://www.minaki.co.uk - Photography section) If you want it in .NET I'd be happy to extract the script for you.
__________________
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 01-05-2006, 03:03 AM
howardroark's Avatar
Extreme Talker

Posts: 181
Trades: 0
Looking at hotscripts.com would be a good idea, too. Look under image galleries...
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
howardroark is offline
Reply With Quote
View Public Profile Visit howardroark's homepage!
 
Old 01-05-2006, 10:08 AM
tammyhart's Avatar
Extreme Talker

Posts: 212
Location: Birmingham, AL
Trades: 0
My server supports asp and .NET, so whichever you think would be the easiest for me. That's really awesome guys, thanks! Let me know anytime if I can help you with graphics and web design, I'd be happy to help.
__________________
Tammy Hart

Please login or register to view this content. Registration is FREE
tammyhart is offline
Reply With Quote
View Public Profile Visit tammyhart's homepage!
 
Old 01-05-2006, 02:08 PM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
Well classic ASP is coming on obsolete now so I'd go with .NET

This script categorizes images. To create a category, create a folder in whatever the root directory is. The name of the category will be taken from the name of the folder. Put the images for that category into that folder. So it's something like this:
/images/photos/
--Summer Holiday 2004/
----Me.jpg
----The Hotel.jpg
----Palm Tree.jpg
--Our House/
----Bedroom.jpg
----Living Room.jpg
----Kitchen.jpg
et...
The script isn't perfect - theres a couple of characters you can't use in filenames, such as an ampersand. Although a couple of likes of code could probably fix that one.
I'd appriciate a link back to www.minaki.co.uk ("Image Gallery script provided by Minaki Serinde") but it's not really required. This code is public domain, so feel free to modify, redistribute, or do what you liek with it.
This is the default category list page. It outputs the list of folders. You'll need to change /images/photos/ to whatever directory you keep the photos under
Code:
<%@ Page Language="VB" %>
<%@ Import Namespace="System.IO" %>
<script runat="server">
 Sub Page_Load
  Dim dirInfo as New DirectoryInfo(Server.MapPath("/images/photos/"))
  repCategories.DataSource = dirInfo.GetDirectories()
  repCategories.DataBind()
 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>Photo Gallery Category List</title>
 </head>
 <body>
  <asp:Repeater id="repCategories" runat="server">
   <HeaderTemplate>
    <ul>
   </HeaderTemplate>
   <ItemTemplate>
    <li><a href="gallery.aspx?category=<%# DataBinder.Eval(Container.DataItem, "Name") %>" title="<%# DataBinder.Eval(Container.DataItem, "Name") %>"><%# DataBinder.Eval(Container.DataItem, "Name") %></a></li>
   </ItemTemplate>
   <FooterTemplate>
    </ul>
   </FooterTemplate>
  </asp:Repeater>
 </body>
</html>
This is gallery.aspx - it displays a list of thumbnails generated from the specified category. You'll need to change the directory again. You can also specify a different thumbnail width by passing a different value to thumbnail.aspx
Code:
<%@ Page Language="VB" %>
<%@ Import Namespace="System.IO" %>
<script runat="server">
 Sub Page_Load
  Dim dirInfo as New DirectoryInfo(Server.MapPath("/images/photos/" & Request.Params("category") & "/"))
  repImages.DataSource = dirInfo.GetFiles("*.jpg")
  repImages.DataBind()
 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>Photo Gallery - <%= Request.Params("category") %></title>
 </head>
 <body>
  <asp:Repeater id="repImages" runat="server">
   <HeaderTemplate>
    <h1><%= Request.Params("category") %></h1>
    <div style="text-align: center;">
   </HeaderTemplate>
   <ItemTemplate>
    <a href="image.aspx?filename=<%# Left(DataBinder.Eval(Container.DataItem, "Name"), Len(DataBinder.Eval(Container.DataItem, "Name")) - 4) %>&category=<%= Request.Params("category") %>"><img class="thumb" src="thumbnail.aspx?width=100&filename=<%# Left(DataBinder.Eval(Container.DataItem, "Name"), Len(DataBinder.Eval(Container.DataItem, "Name")) - 4) %>&category=<%= Request.Params("category") %>" alt="<%# Left(DataBinder.Eval(Container.DataItem, "Name"), Len(DataBinder.Eval(Container.DataItem, "Name")) - 4) %>"></a>
   </ItemTemplate>
   <FooterTemplate>
    </div>
   </FooterTemplate>
  </asp:Repeater>
 </body>
</html>
thumbnail.aspx - Gets an image and generates a thumbnail. Loads /images/error.gif if there's an error loading the image.
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("/images/photos/" & Request.Params("category") & "/" & Request.QueryString("filename") & ".jpg")
 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>
image.aspx - Loads the full sized image. It also checks the referer to prevent hotlinking. If you don't mind people hotlinking your images, you can take the code out. It also watermarks the image, again you can cut that code out or change the watermark text.
Code:
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="Microsoft.VisualBasic" %>
<script runat="server">
 Dim objImage As System.Drawing.Image
 Dim strFilename As String
 Dim Img As Graphics
 Dim HotLinked As Boolean
 Dim CopyText As String
 Sub Page_Load
  HotLinked = False
  ' Delete this line if you want to allow people to leech of your site, i.e. hotlink to your images
  If (Request.UrlReferrer.Host <> "www.minaki.co.uk") and (Request.UrlReferrer.Host <> "localhost") Then HotLinked = True
  CopyText = "© www.minaki.co.uk"
  strFilename = Server.MapPath("/images/photos/" & Request.Params("category") & "/" & Request.QueryString("filename") & ".jpg")
  Try
   If Not HotLinked Then
    objImage = objImage.FromFile(strFilename)
   Else
    objImage = objImage.FromFile(Server.MapPath("/images/hotlink.jpg"))
   End If
  Catch
   objImage = objImage.FromFile(Server.MapPath("/images/error.gif"))
  End Try
  Img = Graphics.FromImage(objImage)
 
  ' -------- CUT HERE IF YOU DON'T WANT A WATERMARK --------
  Dim MyFont As Font = New Font("Arial", 60, FontStyle.Bold, GraphicsUnit.Pixel)
  Dim MyColor As Color = Color.FromArgb(60, 0, 0, 0)
  Dim MyBrush As SolidBrush = New SolidBrush(MyColor)
  Dim I
  For I = 0 to (objImage.Size.Height / 120)
   Dim MyPoint As PointF = New PointF(I * 120, I * 120)
   Img.DrawString(CopyText, MyFont, MyBrush, MyPoint)
  Next I
  ' -------- END CUT --------
  Response.ContentType = "image/jpeg"
  objImage.Save(Response.OutputStream, Imaging.ImageFormat.Jpeg)
  objImage.Dispose()
  Img.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

Last edited by Minaki; 01-05-2006 at 03:37 PM..
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 01-07-2006, 11:41 PM
tammyhart's Avatar
Extreme Talker

Posts: 212
Location: Birmingham, AL
Trades: 0
okay.. i'm a dummy. give me a step 123

P.S.- I'll gladly give you a link back.
__________________
Tammy Hart

Please login or register to view this content. Registration is FREE
tammyhart is offline
Reply With Quote
View Public Profile Visit tammyhart's homepage!
 
Old 01-08-2006, 12:28 AM
EGS
EGS's Avatar
Banned

Posts: 862
Name: Justice McCay
Location: New Jersey
Trades: 2
Let us know if everything works out!
EGS is offline
Reply With Quote
View Public Profile
 
Old 01-08-2006, 12:18 PM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
1. Create the directory structure in your website as outlined above, and put your images in it.
2. Create the 4 pages above (default.aspx, gallery.aspx, thumbnail.aspx and image.aspx)
3. Change the path to point to the directory you created in step 1. You'll need to do that in all 4 pages.
4. Edit image.aspx if you want to change/remove the watermark, or if you don't want hotlink protectio
That's it. Just call up default.aspx and it should list the category folders. Click on a category, it should display a list of thumbnails. Click a thumbnail, and it should display the full sized image.
__________________
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 01-08-2006, 02:02 PM
tammyhart's Avatar
Extreme Talker

Posts: 212
Location: Birmingham, AL
Trades: 0
sp when i want ppl to see my gallery, i link to gallery.aspx? It displays like a regular page?
__________________
Tammy Hart

Please login or register to view this content. Registration is FREE
tammyhart is offline
Reply With Quote
View Public Profile Visit tammyhart's homepage!
 
Old 01-09-2006, 01:24 AM
tammyhart's Avatar
Extreme Talker

Posts: 212
Location: Birmingham, AL
Trades: 0
okay, i gotsa problem

http://www.tammyhartdesigns.com/default.aspx

click on the listing
__________________
Tammy Hart

Please login or register to view this content. Registration is FREE
tammyhart is offline
Reply With Quote
View Public Profile Visit tammyhart's homepage!
 
Old 01-09-2006, 04:19 AM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
Change the top line of gallery.aspx - add debug="true" like this:

<%@ Page Language="VB" debug="true" %>

That will enable the page to display the full error message. (Don't forget to take it back out when you've resolved the error). If you don't understand the error message post it here and I'll see if I can help.
__________________
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 01-09-2006, 03:59 PM
tammyhart's Avatar
Extreme Talker

Posts: 212
Location: Birmingham, AL
Trades: 0
still says the same thing:
Quote:
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".


<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>


Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.


<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
__________________
Tammy Hart

Please login or register to view this content. Registration is FREE
tammyhart is offline
Reply With Quote
View Public Profile Visit tammyhart's homepage!
 
Old 01-11-2006, 02:08 PM
tammyhart's Avatar
Extreme Talker

Posts: 212
Location: Birmingham, AL
Trades: 0
any help at all?
__________________
Tammy Hart

Please login or register to view this content. Registration is FREE
tammyhart is offline
Reply With Quote
View Public Profile Visit tammyhart's homepage!
 
Old 01-11-2006, 03:15 PM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
Hmm sorry didn't realise this thread had been updated.

Make a file called web.config containing the following and put it in your web application root:
Code:
<?xml version="1.0"?>
<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>
and then it should display the full error...
__________________
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 01-11-2006, 07:58 PM
tammyhart's Avatar
Extreme Talker

Posts: 212
Location: Birmingham, AL
Trades: 0
what's my web application root?
__________________
Tammy Hart

Please login or register to view this content. Registration is FREE
tammyhart is offline
Reply With Quote
View Public Profile Visit tammyhart's homepage!
 
Old 01-12-2006, 12:03 AM
tammyhart's Avatar
Extreme Talker

Posts: 212
Location: Birmingham, AL
Trades: 0
Okay, i was able to fix te original error, but now i have a new one

www.tammyhartdesigns.com/default.aspx
__________________
Tammy Hart

Please login or register to view this content. Registration is FREE
tammyhart is offline
Reply With Quote
View Public Profile Visit tammyhart's homepage!
 
Old 01-12-2006, 04:23 AM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
That's telling me it can't load the image for some reason. Open up thumbnail.aspx, and change:
Code:
 Try
  objImage = objImage.FromFile(strFilename)
 Catch
  objImage = objImage.FromFile(Server.MapPath("/images/error.gif"))
 End Try
to:
Code:
' Try
  objImage = objImage.FromFile(strFilename)
 'Catch
'  objImage = objImage.FromFile(Server.MapPath("/images/error.gif"))
' End Try
(basically commenting out the lines). Then it will display the error as to why it can't load the image.
__________________
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 01-12-2006, 11:39 AM
tammyhart's Avatar
Extreme Talker

Posts: 212
Location: Birmingham, AL
Trades: 0
still getting this:
Quote:
Server Error in '/' Application.
--------------------------------------------------------------------------------

A Graphics object cannot be created from an image that has an indexed pixel format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: A Graphics object cannot be created from an image that has an indexed pixel format.

Source Error:


Line 22: objImage = objImage.FromFile(Server.MapPath("/images/error.gif"))
Line 23: End Try
Line 24: Img = Graphics.FromImage(objImage)
Line 25:
Line 26: ' -------- CUT HERE IF YOU DON'T WANT A WATERMARK --------


Source File: d:\domains\tammyhartdesigns.com\wwwroot\image.aspx Line: 24

Stack Trace:


[Exception: A Graphics object cannot be created from an image that has an indexed pixel format.]
System.Drawing.Graphics.FromImage(Image image) +206
ASP.image_aspx.Page_Load() in d:\domains\tammyhartdesigns.com\wwwroot\image.aspx :24
System.Web.Util.ArglessEventHandlerDelegateProxy.C allback(Object sender, EventArgs e) +10
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET Version:1.1.4322.2300
__________________
Tammy Hart

Please login or register to view this content. Registration is FREE
tammyhart is offline
Reply With Quote
View Public Profile Visit tammyhart's homepage!
 
Old 01-13-2006, 05:01 AM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
Looks like it can;t load the images for some reason. Try opening them up in an image editing program and saving them as a different format.
__________________
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 script?

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.90886 seconds with 12 queries