ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old August 26th, 2004, 05:13 PM
Brutality Brutality is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 24 Brutality User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Image gallery next/previous problem

Having been forced to revisit an old photoalbum reated seveal years ago, I've attempted to make some changes/improvements. But now I'm stuck, and this really is the last thing I wish to accomplish. So here's what I have so far (using fusebox).....

qry_photos.cfm
---------------
<cfset serverdir = "d:\serverpath\photos\full\">
<cfset httpdir = "http://www.url.com/photos/full">

<!--- retrieve all JPGs --->
<cfdirectory name="getrecords"
action="list"
directory="#serverdir#"
filter="*.jpg" >

act_photos.cfm
---------------
<cfparam name="displayamount" default="6">
<cfparam name="startrecord" default="1">

<cfif #getrecords.recordcount# GT (startrecord + (displayamount -1))>
<cfset displaynext = startrecord + (displayamount -1)>
<cfelse>
<cfset displaynext = getrecords.recordcount>
</cfif>

<cfset count = 1>

<cfloop query="getrecords" startrow="#startrecord#" endrow="#displaynext#">
<cfoutput>
<cfset pic_array[count] = '#getrecords.name#'>
<cfset count = count + 1>
</cfoutput>
</cfloop>


and in dsp_photos.cfm
---------------------
<h2>Photo Gallery</h2>
<p>This is a collection of sample gallery photos from the Hokonui Fashion Awards</p><br / >

<div id="gallery">
<cfoutput>
<cfif getrecords.recordcount IS NOT 0>
<cfif startrecord GT 1>
<cfset prevrecord = (#startrecord# - #displayamount#)>
<a href="#self#?fuseaction=#xfa.photos#&startrecord=#prevrecord#" class="prevnext">&##171; Previous</a>
</cfif>
<cfif getrecords.recordcount GT (#startrecord# + (#displayamount# - 1))>
<cfset nextrecord = #displaynext# + 1>
<a href="#self#?fuseaction=#xfa.photos#&startrecord=#nextrecord#" class="prevnext">Next &##187;</a>
</cfif>
<cfelse>
<p>There are no images at this time.</p>
</cfif>
</cfoutput>


<div style="width:360px; padding-top:10px;">

<cfloop from="1" to="#ArrayLen( pic_array )#" index="i">
<cfoutput>
<cfif pic_array[i] EQ "0">
<cfelse>
<a href="#self#?fuseaction=#xfa.photosFull#&imgsrc=#directoryFull##pic_array[i]#&returnrecord=#startrecord#">
<img src="#directoryTn##pic_array[i]#" alt="" height="150" width="100" />
</a>
</cfif>
</cfoutput>
</cfloop>

</div>
</div>

in dsp_photosFull.cfm the image is called like so....
<cfoutput><img src="#imgsrc#" border="0"><br /><br />
<a href="#self#?fuseaction=#xfa.photos#&startrecord=#returnrecord#" class="prevnext">Back to Thumbs</a>
</cfoutput>

At the outset I wasn't using an array since it wasn't initially a requirement for any output. But now I wish to click on one of the thumbnail images displayed in dsp_photos.cfm and open that image in dsp_photosFull.cfm. So far this is working fine. But now I also want a previous/next button on this page that will display the next (or previous) full image (without returning to the thumbnails page) hence the use of an array. This has to work even when I'm viewing the last full size image of the current array (ie the 6th image of the array, so the "next" image will be the first result from the next arrray set) I hope this makes sense. Any ideas??

All help appreciated
TIA
MarkH

Reply With Quote
  #2  
Old August 26th, 2004, 06:52 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,626 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 6 m 34 sec
Reputation Power: 53
What exactly is the problem now? It will let you go forward and backward, but when you are at 6 it tries to go on to 7 when you hit next, and when you are at one it tries to go back to 0 when you hit previous?
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old August 26th, 2004, 07:08 PM
Brutality Brutality is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 24 Brutality User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by kiteless
What exactly is the problem now? It will let you go forward and backward, but when you are at 6 it tries to go on to 7 when you hit next, and when you are at one it tries to go back to 0 when you hit previous?


On the dsp_photoFull.cfm page I don't actually know how to evaluate the current full image position so that I can work out which image should come next (and the same for previous). When I was tinkering with setting a previous and next values I did get an error saying that position 7 of the array was undefined (bI received this error when I was trying to evaluate the next and previous fields on dsp_photos.cfm)...so yes, what you outline is definitely one issue.

Maybe arrays aren't the right idea here. Would one full list of all images be easier to work with (perhaps).

Reply With Quote
  #4  
Old August 26th, 2004, 10:43 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,626 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 6 m 34 sec
Reputation Power: 53
Lists probably wouldn't be any better than arrays. I guess I'm not sure why you can't determine if you're at the end or beginning of the list. You're passing the "position" in the array as a URL value, so can't you use that to determine where you are in the array? Am I missing something?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Image gallery next/previous problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway