SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    May 2004
    Location
    New Zealand
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    image display/controling options

    Hiya Guys...

    I've got a directory site for accommodation providers. I would like them to have the ability to display a couple of images on their details page.

    I can easily set it up so they upload images to my server and DB and are displayed etc etc... But I would rather have them just provide the links so that the pictures remain on their website etc.... The only issue I have is what happens if it is a bad link. By uploading to my server I can remove the risk of images not appearing, but by using a link, is there a way of 'testing' whether there is an image at the end of the link. Is there a script out there capable of verifying if an image file is where it should be for veiwing? My initial thought was to have a script that tests the image link for a width <> 0. On the page I would use an IF statement to allow displaying of the image if the image existed..... BUT HOW ??????

    cheers
    Dave

  2. #2
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    Public Function FExists(OrigFile As String)
    Dim fs
    Set fs = CreateObject("Scripting.FileSystemObject")
    FExists = fs.fileexists(OrigFile)
    End Function
    That should work to check if a file exists...
    Code:
    If FExists(yourImage.jpg) Then
     'your logic
    Else
     'whatever
    End If

  3. #3
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The above coding will work great, if the file was on your server, since it is on the other server, you would be better off using javascript on this one, I had created a script for a user that required a way of being able to get the image dimensions from an image before it's uploaded.

    Basically all you use is javascript to pull the image onto the webpage, easy, then either use javascript/asp to verify the image, you can do this using dimensions, if the image dimensions have not changed from none to a set number, then it's failed, it the image appears or there is valid dimensions then validated...

    I will try and knock you a script up later.

    Gav


Bookmarks

Posting Permissions

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