+ /**
+ * Save image data for the given path in the public space, if possible,
+ * for the provided storage mechanism.
+ */
+ protected function saveImageDataInPublicSpace(Storage $storage, string $path, string $data)
+ {
+ $storage->put($path, $data);
+
+ // Set visibility when a non-AWS-s3, s3-like storage option is in use.
+ // Done since this call can break s3-like services but desired for other image stores.
+ // Attempting to set ACL during above put request requires different permissions
+ // hence would technically be a breaking change for actual s3 usage.
+ $usingS3 = strtolower(config('filesystems.images')) === 's3';
+ $usingS3Like = $usingS3 && !is_null(config('filesystems.disks.s3.endpoint'));
+ if (!$usingS3Like) {
+ $storage->setVisibility($path, 'public');
+ }
+ }
+