When I attach an image with mybb attachment function
the image file is not cached and is loaded every time I load the page.
This is a waste of traffic
Can an attached image be cached?
(2018-08-06, 12:23 AM)alstn13178 Wrote: [ -> ]The image url of mybb's attachment ends in php, not ending in png or jpg.
So I do not know if the image is cached.
image of the attachment in the post be cached?
I am not aware of any images ending in .php.
.php is a source hypertext file, not an image.
So I do not know if the image is cached.
image of the attachment in the post be cached?
when I upload image. I get php url.
Ok, do you have the Attachments setup in your AdminCP like it's shown in the screenshot below?
![[Image: afbd25251a7df9c738bdf7e9267bf6c5.png]](https://camo.mybb.com/c96615f192c2478f4f7467e21631eea4f2f82058/68747470733a2f2f692e6779617a6f2e636f6d2f61666264323532353161376466396337333862646637653932363762663663352e706e67)
(2018-08-06, 01:00 AM)alstn13178 Wrote: [ -> ]yes I have it
One of the MyBB experts should be able to assist you.
I am not certain what else it can be.
Compared to imgur,
uploaded Images with mybb attachments are loaded every time when I click F5. Not cached
$img = $mybb->settings['uploadspath']."/".$attachment['attachname'];
$time_up = $attachment['dateuploaded'];
$etag=md5($time_up.$img);
$time=gmdate('r', $time_up);
header('Last-Modified: '.$time);
header("Cache-Control: must-revalidate");
header('Expires: '.$time);
header("Etag: ".$etag);
I seem to have found a way.
Attaching this header to image in attachment.php will cache it.