Comments (6)
I was not happy with the fix in v1.0.7. I released v1.0.8. You would need to update your config/thumbnail.php
and remove the /
. That would allow every file on that disk.
'allowedSources' => [
// ...
's3_g' => ['disk' => 's3_gallery', 'path' => ''], // <-- add the new disk
],
from laravel-thumbnail.
Hey, thanks for the report.
Is the error you are getting like: Source is not allowed. Given path "1.jpg" on disk "test"
?
I got the above error when trying it myself with:
\Thumbnail::src('1.jpg', 'test')>url();
It looks like the library needs the leading slash. With the following code it worked:
\Thumbnail::src('/1.jpg', 'test')>url();
I updated the library to support omitting the leading slash. The fix is in v1.0.7.
from laravel-thumbnail.
Thank you for your reply @rolandstarke
I currently have this and it works:
{{ Thumbnail::preset('gallery')->src('bucket/gallery/'.$value->path, 's3')->url(true) }}
to sort it all out I'm implementing filesystems with scope, and here's the scope I'm using:
's3_gallery' => [
'driver' => 'scoped', // This is the new scoped driver!
'disk' => 's3', // It uses the `s3` disk above
'prefix' => 'bucket/gallery',
],
So here is the new code, I get the error, however::
{{ Thumbnail::preset('gallery')->src($value->path, 's3_gallery')->url(true) }}
Source is not allowed. Given path "2472/mO84aKBl6lpQnxPNDyPt5gltlge.webp" on disk "s3_gallery"
I tried as you say, with the slash in front, but I keep getting the error:
{{ \Thumbnail::preset('gallery')->src($value->path, 's3_gallery')->url(true) }}
I believe that he has problems using the scoped filesystem
from laravel-thumbnail.
I believe the issue could be that in config/thumbnail.php
you would need to add the new disk as an allowed source. I hope then it works.
'allowedSources' => [
// ...
's3_g' => ['disk' => 's3_gallery', 'path' => '/'], // <-- add the new disk
],
from laravel-thumbnail.
Thank you very much, the files are now read correctly. Just a small note though:
I added in thumbnail.php:
in allowedSources
's3_g' => ['disk' => 's3_gallery', 'path' => ''],
s3_g
What would it stand for? this parameter when used? in my blade i used:
{{ Thumbnail::preset('gallery')->src($value->path, 's3_gallery')->url() }}
It would be really nice if it read data from filesystems.php instead of having to indicate routes. anyway great job, definitely the best thumbnail package
from laravel-thumbnail.
s3_g
can be any string you want. You don't need and can't use it anywhere. It's used by the library as a param in the URL. ?s=s3_g
. I picked a short name, so that the URL does not get longer than needed.
Thanks for the feedback. Allowing every disk from the filesystems.php would simplify the usage of the library. So that you don't need to fiddle around with the allowedSources settings. I am not sure if users rely on the security to list every disk they want to load images from.
from laravel-thumbnail.
Related Issues (13)
- Images not viewable for chmod permissions HOT 3
- Relative URL HOT 2
- Folder no exist HOT 2
- Source is not allowed. Given path HOT 5
- Passing null to parameter #1 ($string) of type string is deprecated HOT 1
- implement dont-crop HOT 1
- Delete single thumbnail HOT 1
- CDN Storage Thumbnail Creation Error HOT 10
- Update to php 8 HOT 1
- FR: Support FILESYSTEM_CLOUD as an alternate to $disk
- Port for path HOT 1
- need resize function HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-thumbnail.