how to check images on if statement?
Results 1 to 2 of 2

Thread: how to check images on if statement?

  1. #1
    Senior Member
    Join Date
    Sep 2008
    Posts
    116

    how to check images on if statement?

    Hi guys,

    I need your help, I want to create a filename for the image on the webpage and I also want to out how I can check on the if statement to see if the image on the webpage is exist.

    Code:
    $image1 = <div id="image1" style="position:absolute; overflow:hidden; left:415px; top:157px; width:114px; height:81px; z-index:0"><img src="/images/tvguide_blue.jpg" alt="" title="" border=0 width=114 height=81></div>

    On the webpage, it display as "$image =". Does anyone know how i can create a function for a filename so I can write something like this:

    Code:
    if ($image = exist) { 
      // do something
    }
    Does anyone have any idea?

    thanks in advance

  2. #2
    Senior Member traq's Avatar
    Join Date
    Jun 2011
    Location
    so.Cal
    Posts
    949
    file_exists().
    PHP Code:
    <?php

    if( file_exists$_SERVER['DOCUMENT_ROOT'].'/images/tvguide_blue.jpg' ) ){
        
    // do something
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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