Thinking again about my question, I realized that I do not need to disable caching in my PHP file than on images. Therefore, I used the htaccess file as shown below:
<FilesMatch "\.(gif|jpg|jpeg|png|gif)$">
Header set Cache-Control "no-transform"
</FilesMatch>
Now caching of all images has disappeared, and the site is working fine.
source
share