Fix issue where resized images were not correctly identified as already having been resized when atomic (blue/green) deployment strategies are used in conjunction with files being stored on the local filesystem in a shared symlinked storage folder.

This commit is contained in:
Luke Towers 2020-09-18 00:11:11 -06:00
parent 618e2b58ab
commit fe2ca6c15e

View File

@ -219,9 +219,21 @@ class ImageResizer
*/
public function getConfig()
{
$disk = $this->image['disk'];
// Normalize local disk adapters with symlinked paths to their target path
// to support atomic deployments where the base application path changes
// each deployment but the realpath of the storage directory does not
if (FileHelper::isLocalDisk($disk)) {
$realPath = realpath($disk->getAdapter()->getPathPrefix());
if ($realPath) {
$disk->getAdapter()->setPathPrefix($realPath);
}
}
$config = [
'image' => [
'disk' => $this->image['disk'],
'disk' => $disk,
'path' => $this->image['path'],
'source' => $this->image['source'],
],