Explaination:
By using PHP function if the Images already exit r not ion the image folder we have to check out using file_exists function r @get_headers.And for backgroung image we have to display in image folder means we have to take anyone has common such as id r name.
Here for example i took id we have to select and fetch with DB and that variable put itin to the imagepath.
Note:Sometimes file_exists function will not work
Coding:
By using PHP function if the Images already exit r not ion the image folder we have to check out using file_exists function r @get_headers.And for backgroung image we have to display in image folder means we have to take anyone has common such as id r name.
Here for example i took id we have to select and fetch with DB and that variable put itin to the imagepath.
Note:Sometimes file_exists function will not work
Coding:
$url = "images/group_hotel_".trim($ID).".jpg"; $file_headers = @get_headers($url); if($file_headers[0] == 'Not Found') { $banner = "images/group_hotel_nobanner.jpg"; } else { $banner = "images/group_hotel_".trim($ID).".jpg"; }
form:
Display the image as in image foldder
<div class="search_bg" style="background-image: url('<?php echo $banner; ?>');">
No comments:
Post a Comment