Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-07-2013, 11:53 PM   PM User | #1
mark103
New Coder

 
Join Date: Sep 2008
Posts: 79
Thanks: 1
Thanked 0 Times in 0 Posts
mark103 is an unknown quantity at this point
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
mark103 is offline   Reply With Quote
Old 03-08-2013, 12:06 AM   PM User | #2
tempz
Regular Coder

 
Join Date: Jul 2012
Location: London
Posts: 436
Thanks: 4
Thanked 80 Times in 80 Posts
tempz is an unknown quantity at this point
Quote:
Originally Posted by mark103 View Post
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
PHP Code:
$file '/path/to/foo.txt'// 'images/'.$file (physical path)

if (file_exists($file)) {
    echo 
"The file $file exists";
} else {
    echo 
"The file $file does not exist";

If the image path exists or if the image has been displayed on the webpage?
tempz is offline   Reply With Quote
Old 03-08-2013, 12:19 AM   PM User | #3
mark103
New Coder

 
Join Date: Sep 2008
Posts: 79
Thanks: 1
Thanked 0 Times in 0 Posts
mark103 is an unknown quantity at this point
yes, i want to check if the image has been displayed on the webpage.

I want to check the image using with this statement:

Code:
if (e.keyCode == '38') {
       window.alert('up arrow')
    }

Do you have any idea how i can check if the image has been displayed on the webpage?
mark103 is offline   Reply With Quote
Old 03-08-2013, 03:51 AM   PM User | #4
KULP
Regular Coder

 
Join Date: Mar 2012
Posts: 166
Thanks: 5
Thanked 11 Times in 11 Posts
KULP is an unknown quantity at this point
Quote:
Originally Posted by mark103 View Post
yes, i want to check if the image has been displayed on the webpage.

I want to check the image using with this statement:

Code:
if (e.keyCode == '38') {
       window.alert('up arrow')
    }

Do you have any idea how i can check if the image has been displayed on the webpage?
You could pass a value through a POST or GET variable that the page will display an image?

Or you can have a variable $displayed and as the page renders, if a specific image is loaded you set $displayed to true.

Otherwise I'm not sure how you could implement this... You may get better results in the PHP section.
KULP is offline   Reply With Quote
Old 03-08-2013, 05:52 AM   PM User | #5
RobertWoges
New Coder

 
Join Date: Jan 2013
Posts: 52
Thanks: 1
Thanked 2 Times in 2 Posts
RobertWoges is an unknown quantity at this point
You can try this one.

$file = '/path/to/foo.txt'; // 'images/'.$file (physical path)

if (file_exists($file)) {
echo "The file $file exists";
} else {
echo "The file $file does not exist";
}
RobertWoges is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:14 PM.


Advertisement
Log in to turn off these ads.