rolandstarke / laravel-thumbnail Goto Github PK
View Code? Open in Web Editor NEWLaravel package to resize images with specially formatted URLs
Home Page: https://rolandstarke.github.io/laravel-thumbnail/
License: MIT License
Laravel package to resize images with specially formatted URLs
Home Page: https://rolandstarke.github.io/laravel-thumbnail/
License: MIT License
please add resize function for change height and width together
{{ Thumbnail::src(public_path($photo->path))->smartcrop(200, 200)->url() }} - return path. But folder "thumbnails" not created
I am using FILESYSTEM_CLOUD in .env to decouple the cloud disk driver from my application.
For example, instead of Storage::disk('spaces')
I can do this: Storage::cloud()
which allows me to easily swap out the disk by changing one line in the .env file.
Currently to achieve this with laravel-thumbnail I am doing this:
'allowedSources' => [
'cloud' => ['disk' => env('FILESYSTEM_CLOUD', 'local'), 'path' => '/'],
],
'presets' => [
'cloud' => [
'destination' => ['disk' => env('FILESYSTEM_CLOUD', 'local'), 'path' => '/thumbnails/default/'],
'smartcrop' => '256x256',
],
],
And using it like this:
$data = Thumbnail::preset('cloud')->src($path, config('filesystems.cloud'))->string(true);
Would be awesome if I could do something like this instead:
'allowedSources' => [
'cloud' => ['cloud' => true, 'path' => '/'],
],
'presets' => [
'cloud' => [
'destination' => ['cloud' => true, 'path' => '/thumbnails/default/'],
'smartcrop' => '256x256',
],
],
$data = Thumbnail::preset('cloud')->cloud()->src($path)->string(true);
Since I upgraded to Laravel 9 and PHP 8.1.5, I've noticed that it correctly creates thumbnails but they are not showing.
In checking the routes I noticed that:
/httpdocs/storage/crops/news/1z/yz
yz = 0700
towrmhfoogoog48ow4osc.jpg
0644
if I put permissions 0755 on folders and files the images will be viewable...
Please can you update your composer.json to allow php 8:
"require": {
"php": "^7.1.3|^8.0",
"intervention/image": "^2.0"
},
How can I configure the package to generate relative urls?
I found this packages by accident, and I already like it so much but I have a question. I have the original images in a DigitalOcean Spaces CDN called in Laravel's filesystem “do_spaces”.
So the image for example is:
\Thumbnail::src('projectx/article/00b9c8c0e4123c441353050cceafb173.jpg', 'do_spaces' );
How can I make him save me image in:
projectx/crops/.*
in config:
'ld' => ['disk' => 'do_spaces', 'path' => 'projectx/'], //allow images to be loaded from `Storage::disk('local')`
'pd' => ['disk' => 'do_spaces', 'path' => 'projectx/'],
'destination' => ['disk' => 'do_spaces', 'path' => 'projectx/crops/'],
Blade:
{{ Thumbnail::src('projectx/article/00b9c8c0e4123c441353050cceafb173.jpg', 'do_spaces')->url() }}
but when the url is generated in the blade:
https://***.ams3.digitaloceanspaces.com/projectx/crops/db9/ag5cy0kooo40w4g4go0so8.jpg%3Fp%3Darticle%252F00b9c8c0e4123c441353050cceafb173.jpg%26s%3Dld
and the image does not exist, where am I wrong?
Source is not allowed. Given path error given when trying to generate thumbnail.
src="{{\Thumbnail::src(storage_path('public/'.$pnews->primary_img)) }}"
Scopes are not compatible, you get an error that it does not have permission to access the file.
OS: Mac OSX
PHP: 8.1.6
Laravel: 9.11
Deprecated: sha1(): Passing null to parameter #1 ($string) of type string is deprecated in /Applications/XAMPP/xamppfiles/htdocs/Project/config/thumbnail.php on line 9
How should i delete single thumbnail ? if the src picture updates the old thumbnail is cached.
Think you could implement dont-crop lib ?
I use a port for my website, so how can I configure that in thumbnail?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.