Image and Databases

Results 1 to 5 of 5

Thread: Image and Databases

  1. #1
    Jaime Scarpatti Guest

    Default Image and Databases

    I am trying to setup a page that querries a database for a user&#039s information, and then it dilspays a picture of the person. The pictures are in a seperate file. therefore I have to call the username.jpg to get the file. How can I create a asp page to do just that, and to show me all the users that have images, and not those that do not.<BR><BR>Thanks.

  2. #2
    Join Date
    Dec 1969

    Default RE: Image and Databases

    The FileSystemObject has a method "FileExists"<BR>Function FileExists(ByVal FileSpec As String) As Boolean<BR> Member of Scripting.FileSystemObject<BR> Check if a file exists<BR><BR>Loop through your recordset and display only those where the file exists.<BR><BR>If you need them sorted into two groups based on the existence of the image file, you might need to go through your recordset twice.<BR><BR>Does that help?<BR>

  3. #3
    Hill Guest

    Default RE: Image and Databases

    Just adding to Andrew&#039s solution.<BR><BR>When loop through your recordset<BR>you can just set a condition to display the image<BR>if exist..else...display something else...or nothing<BR>.<BR>.<BR>.

  4. #4
    Gary Van Sluis Guest

    Default RE: Image and Databases

    I think that is a very good solution for the question posted. Another solution, quicker, would be to add a boolean flag in your database HASIMAGE. If you are using Access you can use a Yes/No. Then simply put a Where clause in your SQL statement. Using this method you will not have to loop your recordset, which could be quite large. It also will remove conditional logic from your code. It is always a plus when you can remove as much business logic as possible from your front end. <BR>I do not mean to say the posted method is bad or anthing, but I have written many intranet apps doing exactly what you are doing and if you dont need to pull the entire recordset then dont, try to filter as much as possible, making your code more persice and faster.<BR><BR>Hope that helps. <BR>Gary

  5. #5
    Jaime Scarpatti Guest

    Default RE: Image and Databases

    Thanks for all of the suggestions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts