Date based image viewer

Posted on 2003-03-14
Medium Priority
Last Modified: 2013-12-24
I'm building a ColdFusion image viewing app that needs to be able to automatically insert an image link to an SQL database each day and automatically update the image selection form with that date. The image file names are date based so they are predictable and there will only be one new image each day. I want the past images to be selectable through the image selection form so that the user can select a year and month and day to view an image. The image itself will be generated manually so ColdFusion does not need to be involved in image creation.

Does anyone have an idea of how this can be accomplished in ColdFusion?
Question by:McHack
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +3

Expert Comment

ID: 8137498
This would be a nice elegant solution.  Name your files in the following form yyyymmdd_filename.jpg

<cfset images_to_display = 3>

<cfset directory = "C:\InetPub\wwwroot\myimages">

<cfdirectory action="LIST" directory="#directory#" name="get_images" filter="*.jpg" sort="name desc">

<cfoutput query="get_images" maxrows="#images_to_display#">
<a href="images/#name#">#name#</a><br><br>


Expert Comment

ID: 8137758
OK, so the part about adding the image link to the DB automatically everyday: This isn't really a Cold Fusion thing. You COULD setup a page to do the insert, and then add this page as a scheduled task under the ColdFusion Administrator...but that's still a little funky.

How is the image getting to the server to being with? Is someone copying a file to the drive? Is it being generated by a webcam or something?

Since the file names are predictable, there's really not much of a reason to store their links in the DB. In reality you could just use the day/month/year they select to create an image name, then use FileExists to see if the file exists, and if so output it to the user.

Otherwise, if you do have the images in the DB already, we'll need to know exactly the naming convention that you plan to use.

Author Comment

ID: 8137969
The purpose of this app is to allow visitors to view archived images. The images are already online and a new one is created each day and uploaded to the server manually. My reasoning for using the SQL database was that I thought it would be a good way to store links to the images and that an archive form could be made that would use the link data in the database. This would make it possible to make a user friendly interface form to access the image archives. The form itself would increment to include one more selection date based on that days date.

The naming structure of the images is as follows each image is named in a date format like: 030211b.jpg, 030212b.jpg, 030213b.jpg, etc and each months images are stored in folders representing the month like: 01, 02, 03, etc.
The Ideal Solution for Multi-Display Applications

Check out ATEN’s VS1912 12-Port DP Video Wall Media Player at InfoComm 2017. Kerri describes how easy it is to design creative video walls in asymmetric layouts and schedule detailed playlists ahead of time with its advanced scheduling feature.


Expert Comment

ID: 8138077
Create a page for the user to uplaod the images from. When they upload the image from this page, it will insert the new into the DB, and you can then use this table to select the image URL from whe the user selects the date for the image they want to see.

Expert Comment

ID: 8138965
Try inseting the images in to a binary field in MS SQL Server. Then you can reverse it at will for display. I believe MS Access has this capability also.

Expert Comment

ID: 8139381
Inserting BLOB images is not reccommended through Cold Fusion. It has a hard time outputting them.

Expert Comment

ID: 8139482
he said "blob" hehehe

Expert Comment

ID: 8139532
lol..what a freak. =)
LVL 17

Accepted Solution

anandkp earned 1500 total points
ID: 8141344

wont having just the image names in the tables & having the images on ur HDD - do the job for u.

u can also have a column for the date - the image was inserted in the DB & keep the image names as u want to ...

whenever u want to output the images based on the date - fire a query in the DB & select the image names u wanna display - then just display teh images

eg :

<cfquery name="x">
    select imagenames from table where imagedate = #Createodbcdate(now())#

<cfoutput query="x">
   <cfif fileexists('#physical_image_path##imagename#')>
       <img src="#Rel_images_Path##imagename# border="0"><br>

this shld do it for u ... let me know ...

LVL 11

Expert Comment

ID: 8141515
Anand's suggestion is what i would have suggested too.

hope u work it out that way.

Good show anand :-)

LVL 17

Expert Comment

ID: 8202348
hello ???

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question