mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 02:44:29 -04:00
Cache background image
This commit is contained in:
parent
a637a8312a
commit
bdd218ed79
@ -234,6 +234,23 @@ class Document extends EntityModel
|
||||
return $disk->get($this->path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRawCached()
|
||||
{
|
||||
$key = 'image:' . $this->path;
|
||||
|
||||
if ($image = cache($key)) {
|
||||
// do nothing
|
||||
} else {
|
||||
$image = $this->getRaw();
|
||||
cache([$key => $image], 120);
|
||||
}
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
|
@ -89,7 +89,7 @@
|
||||
@endif
|
||||
|
||||
@if ($account->isEnterprise() && $account->background_image_id && $account->background_image)
|
||||
window.accountBackground = "{{ Form::image_data($account->background_image->getRaw(), true) }}";
|
||||
window.accountBackground = "{{ Form::image_data($account->background_image->getRawCached(), true) }}";
|
||||
@endif
|
||||
|
||||
var NINJA = NINJA || {};
|
||||
|
Loading…
x
Reference in New Issue
Block a user