Just wondered, I have the following code:
<a href="<?=$row->aw_deep_link?>">
<?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . 'images/products/' . $row->strId . '.jpg')):?>
<img alt="<?=$row->my_brand . ' ' . $row->line . ' ' . $row->my_product . ' - ' . $row->size.$row->unit?>" height="170" itemprop="image" src="<?=base_url() . 'images/products/' . $row->strId?>.jpg" width="170">
<?php else:?>
<img alt="<?=$row->my_brand . ' ' . $row->line . ' ' . $row->my_product . ' - ' . $row->size.$row->unit?>" height="170" itemprop="image" src="<?=$row->aw_image_url?>" width="170">
<?php endif;?>
</a>
Up until last night, this was performing perfectly; this morning - it's stopped, out of the blue and automatically defaults to the
else
clause.
Has something changed with PHP?
If no files or scripts were changed that you know of (including if the image file is still actually there) then it could have been a server change / update which has caused an error.
My suggestion would be to run some simple tests in a separate file I.e. check the value of your $_SERVER['DOCUMENT_ROOT']
variable, check for the existence of the directory containing your image, then check for the existence of the image.
If you're 100% sure you have changed nothing on the server, I'd suggest contacting your host.