Show how you are adding them to page. Sounds like you are missing a hash/version value
Is there a way to return back without using cached images?
My client wanted me to add a function to rotate images on the site. It's working just fine on my pc but it doesn't show on the server immediately. It only rotates the image after I do Ctrl + F5 I'm guessing it's because images are cached on the server side. Is there a way to prevent that and un-cache all images when redirecting back to the page after the rotation?
As I said it's working fine on my pc, which means I'm not caching any images on my side, it's probably the server doing this. Since it's a control panel that doesn't need to be speedy, I can take something to replicate a Ctrl + F5 hotkey too.
Idk if that matters but here's my function to rotate (using intervention library):
public function flip_photo(Request $request, EstatesPhoto $estatesPhoto)
{
$img_path = $estatesPhoto->path;
$request->input('rotation') == 'left' ? $rotation = 90 : $rotation = -90;
$image = Image::make($img_path);
$image->rotate($rotation);
unlink(public_path($img_path));
$image->save($img_path);
return back();
}
@motinska94 yes that's exactly it. If the name of the file remains the same, the browser will show the same again (from cache). You need to either make sure the file names are unique or add a version as a parameter
Just an example if the image has a hash method. It could be the timestamp of when the file was created
@foreach($estate->images as $image)
<img src="{{ asset($image->path) }}?version={{$image->hash}}" class="estate-image-element">
@endforeach
Please or to participate in this conversation.