Iam using yii framework. i have created a function/controller which check the image file is exist in the directory, if file is exists using file_get_contents() function pass the image and set the background of the div tag. If file is not exists the default image file contain is passing.
syntax php:-
header('Content-Type: image/png');
echo file_get_contents($location);
And in javascript i create a function to draw adiv and set background of that div Syntax:-
function drawDiv()
{
$('.divID').html("<div id="test"></div>")
$('#test').css({background-image : url('http://location/test/getimage')});
}
when ever i redraw the div again the image is download every time. if i set the url absolute path it download once.
what i want is that if the image is exist or not exist the should download once. plz solve issue.. if you have another solution tell me.