insaneray
insaneray

Reputation: 83

Caching Dynamic Image in PHP

i have two things to complete in my project, First thing is to hide the image path,That is done using dynamically loading the image (imageJPEG) from imageConvert.php with the parameters,The Second thing is i need to implement client side browser caching, For this i was using the

<link rel='subresource'> 

before ( with normal image path ) , but it is not working with dynamic image loading. Do anybody have solution for this.

echo "<img class='lazy' src='imageConvert.php?raw=$image&cap=ps&hash=$user_id' />";
echo '<link rel="subresource" href="imageConvert.php?raw=$image&cap=ps&hash=$user_id" as="image">'; 

Thanks in advance.

Upvotes: 1

Views: 92

Answers (1)

William Carneiro
William Carneiro

Reputation: 360

Your image will not be cached by the browser because, as you know, it's a dynamic image being printed by a php script file.

PHP outputs cannot be cached by the browser, so if you wanna hide the image path, try to use a Rewrite condition in your htaccess to change it to another location.

Upvotes: 1

Related Questions