4 Replies Latest reply on Nov 13, 2006 3:12 AM by score1

    Images from external folder

    score1
      I have a database that pulls an image from an image folder that is not part of the DB. The images are named #principal_ID#.png where the principal_id in the DB is a unique number. The corresponding images in the image folder are named after the individuals unique principal_Id so when the name is selected from a list trhe correct image is selected.

      The code used to do this is as follow:

      <cfquery name="profileImage" >
      SELECT DISTINCT dbo.PPS_TRANSCRIPTS.PRINCIPAL_ID
      FROM (dbo.PPS_SCOS JOIN dbo.PPS_TRANSCRIPTS ON dbo.PPS_SCOS.SCO_ID = dbo.PPS_TRANSCRIPTS.SCO_ID)
      JOIN dbo.PPS_PRINCIPALS ON dbo.PPS_TRANSCRIPTS.PRINCIPAL_ID = dbo.PPS_PRINCIPALS.PRINCIPAL_ID
      WHERE dbo.PPS_PRINCIPALS.NAME LIKE '#start#'
      AND dbo.PPS_PRINCIPALS.DISABLED IS NULL
      </cfquery>

      Output as follows:

      <td width="22%" rowspan="5"><cfoutput query="profileimage">
      <div align="center"><img src="images/#profileImage.PRINCIPAL_ID#.png" width="100" height="125"></div>
      </cfoutput></td>

      This works OK where there is an image. There are however a large number of names in the DB where we have no image and would like to be able to pull in a defualt image where there is none. The default image is called NAP.

      I need to find a way for CF to pull in the default image where the principal_id does not have the users correct image.

      Hope this makes sense. Any help appreciated.