php - Image height and width when image not found -


i have following code:

<div>   <img src="../images/curry.jpg" height="242" width="300"         alt="can't find image (http://localhost/images/curry.jpg)"> </div> 

i trying precisely lay out page so, if image not found, alt text occupy given height & width.

1) how html/css works?

2) if not, since generating html php, there can achieve want? instance, work if check non-existence , instead of img tage, generate fieldset of desired size, containing alt text?

the answer first question yes. alt attribute seo purposes, , behaves have seen it.

it possible although must warn of additional overhead, there function file_exists() check if image existent.

if function returns false instead of echoing image echo "<p>can't find image (http://localhost/images/curry.jpg)</p>" , add style attribute wrapping div states desired width , height

<div style='height: 242px;width: 300px'> 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -