Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Images display

Posted on 2013-01-09
4
Medium Priority
?
275 Views
Last Modified: 2013-01-26
Hi Experts, I need an Idea on the way i am displaying Images.

On one of my Page,  am showing 6 Images even though Uploaded are 100, The Last Updated are shown.

Now,  have added one Column as HeaderImage and I have sets its value to 1. Now what i want is,

If has to detect the 6 Images which has been recently Updated and it will from thoses6 Images which is the headerImage, Now i want to Place that Header Image on the Main Screen and the First Image to be Shown and other Images displayed after wards

Please provide your suggestions what ways i can try out.

I tried using couple of cffif statements but all in vain. so any suggestions

Thanks
0
Comment
[X]
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
  • 2
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
stu215 earned 2000 total points
ID: 38759454
Do you store info about the uploads in a database? What database fields do you have if so?

or are you just getting info from the files in a directory?

- If stored in a database you can keep whatever info about each upload you need and should be able to easily tell what the last 6 are if you keep the dateTime of when they are uploaded...


Would be something like:

<!--- Assuming there is only ever one headerImage or that you want the most recent one --->
<cfquery name="getHeaderImage" datasource="DS_Name" maxRows="1">
    SELECT dateTimeField, headerImageField, etc ...
    FROM yourTable
    WHERE headerImageField='1'
    ORDER byDateTimeField DESC
</cfquery>

<cfquery name="QName" datasource="DS_Name" maxRows="6">
    SELECT dateTimeField, headerImageField, etc...
    FROM yourTable
    ORDER BY dateTimeField DESC
</cfquery>

<!--- Print getHeaderImage where you want it then loop over the rest by either using maxrows 6 or set 2 different loops with the maxcount at 6 and total rec count --->

<cfloop from="1" to="#QName.recordcount#" index="i">
...
</cfloop>
0
 
LVL 16

Author Comment

by:Gurpreet Singh Randhawa
ID: 38759987
values are coming from DB, but the way you explained, i did not get properly, please explain again.
0
 
LVL 10

Expert Comment

by:stu215
ID: 38760260
Have one query to pull up the Header Image to specifically get the values needed with that record.

A seperate query to pull up the rest of the images.

-- If you do not need all 100 images to display you could use maxrows="6" in the query to limit results

-- If you are displaying the first 6 most recent in a special way and the remainder are to be kept in an array but not displayed then you would not limit it in the query but do so inside a loop using an If statement

I may be misinterpreting what you want but was assuming you are doing something like:
------------------------------------------------
|                                                        |
|                                                        |
|                   Header Image            |
|                                                        |
|                                                        |
------------------------------------------------
|____|____|_____|_____|____|___|   <--- smaller 6 most recent images with slider for 7-100

Header Image = <img src="#getHeaderImage.Path# name="headerimage" .../>


Smaller images=
<cfloop from="1" to="#QName.recordcount#" index="i">
    <cfif #i# LT 7>
        <img src="#getHeaderImage.Path# name="headerimage" .../>
    <cfelse>
        ... store image paths in a JS array ?
    </cfif>
</cfloop>

----------------------  This is mostly pseudocode / a thought on how to do ---------------

Do you have a page  you could link / code that is not working that may give a better idea of what you are trying to do that is not working?
0
 
LVL 16

Author Closing Comment

by:Gurpreet Singh Randhawa
ID: 38822169
yes that's one
0

Featured Post

DFW AZURE MEETUP TONIGHT FRI 6PM

We will be discussing what Azure Stack is, how does it fit into the suit of offerings that Azure has currently, and where can it fit into your organizations technology stack. We will also be discussing limitations of the platform while covering various applicable scenarios.

Question has a verified solution.

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

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

671 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