spatie / laravel-glide Goto Github PK
View Code? Open in Web Editor NEWEasily convert images with Glide
Home Page: https://freek.dev/2015/12/easily-convert-images-with-glide/
License: MIT License
Easily convert images with Glide
Home Page: https://freek.dev/2015/12/easily-convert-images-with-glide/
License: MIT License
Hello,
I get this:
Problem 1
- Installation request for spatie/laravel-glide 2.3.0 -> satisfiable by spatie/laravel-glide[2.3.0].
- spatie/laravel-glide 2.3.0 requires php ^7.0 -> your PHP version (5.6.20) does not satisfy that requirement.
Problem 2
- spatie/laravel-medialibrary 3.17.4 requires spatie/laravel-glide ^2.2.4 -> satisfiable by spatie/laravel-glide[2.3.0].
- spatie/laravel-medialibrary 3.17.4 requires spatie/laravel-glide ^2.2.4 -> satisfiable by spatie/laravel-glide[2.3.0].
- spatie/laravel-glide 2.3.0 requires php ^7.0 -> your PHP version (5.6.20) does not satisfy that requirement.
- Installation request for spatie/laravel-medialibrary 3.17.4 -> satisfiable by spatie/laravel-medialibrary[3.17.4].
Maybe some dependencies went up?
I am trying to add a watermark to my image:
$this->addMediaConversion('large')
->setManipulations(['fm' => 'jpg', 'mark' => 'watermark.png', 'markw' => '40', 'markh' => '40', 'markpad' => '15', 'markpos' => 'top-left'])
->performOnCollections('images');
Following the Glide doc (http://glide.thephpleague.com/1.0/api/watermarks/) I added a new filesystem for watermarks, in the laravel's config/filesystems.php
file.
However, my generated thumb doesnt have any watermark on it. And there is no log error report.
Where should I place my watermark.png
file ? I tried in storage/images
and storage/watermarks
and even modifying 'mark' => storage_path('images/watermark.png')
but I can't get it working.
Hi,
I have this error
exception 'League\Glide\Http\SignatureException' with message 'Signature is missing.' in /home/devmg/public_html/laravel/vendor/league/glide/src/Http/Signature.php:43
and I can't figure out what is the problem. Can somebody help me?
I'm using Laravel 4.2 by the way.
I know I can make a circle Image with watermark, is their any other way to do Circle Image?
The following code should just use a Controller:
$this->app['router']->get($glideConfig['baseURL'].'/{all}', function () use ($glideConfig)
Because cache generation may fail now because of laravel-glide :
php artisan route:cache
Route cache cleared!
[LogicException]
Unable to prepare route [img/{all}] for serialization. Uses Closure.
Can you upgrade the glide version, as the glide version in the composer file is outdated, and I am encountering a lot of issues that have been fixed in the latest version of glide.
Hi,
I am using your medialibrary pachage already,
now I need to install laravel-glide
but when i run
composer require spatie/laravel-glide
it gives me following error
Your requirements could not be resolved to an installable set of packages.
Problem 1
- spatie/laravel-medialibrary 3.17.2 requires spatie/laravel-glide ^2.2.4 -> satisfiable by spatie/laravel-glide[2.x-dev].
- spatie/laravel-medialibrary 3.17.2 requires spatie/laravel-glide ^2.2.4 -> satisfiable by spatie/laravel-glide[2.x-dev].
- spatie/laravel-medialibrary 3.17.2 requires spatie/laravel-glide ^2.2.4 -> satisfiable by spatie/laravel-glide[2.x-dev].
- Can only install one of: spatie/laravel-glide[3.0.0, 2.x-dev].
- Installation request for spatie/laravel-glide ^3.0 -> satisfiable by spatie/laravel-glide[3.0.0].
- Installation request for spatie/laravel-medialibrary == 3.17.2.0 -> satisfiable by spatie/laravel-medialibrary[3.17.2].
Am I doing something wrong?
I am on laravel 5.2
I wanna append an attribute to my Photo Model with a full URL including signature and the dimensions.
Normally I'm doing it in the view, and it works:
<img src="{{ GlideImage::load($photo->path, ['w' => 100, 'h' => 100, 'fit' => 'crop']) }}">
But I want it in my JSON-response for Angular-reasons. So I did this in my Model:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use GlideImage;
class Photo extends Model
{
protected $fillable = ['foobar', 'path'];
protected $appends = ['thumb'];
public function getThumbAttribute()
{
return GlideImage::load($this->path, ['w' => 241, 'h' => 187, 'fit' => 'crop']);
}
}
But that returns just an empty:
What I expected was an URL like: /img/photos/f02cd882f546a30cb435b22c1e337f7b.jpg?w=100&h=100&fit=crop&s=f9b52d8c713ac525da0d6accff50822e
Hi Spatie,
murze.be seem to be down
No more access to documentation :(
Hey
I'm using glide to do some image manipulations on an uploaded image.
When testing locally, everything works but when we deploy to a combell shared hosting, I get the following error:
file_exists(): open_basedir restriction in effect. File(/data/sites/web/scribblrmtantwerpeu/tmp/phpmkV0Wn/f1b906abc87cd37f44c511f8dd7acc88) is not within the allowed path(s): (/data/sites/web/scribblrmtantwerpeu:/usr/local/php-7.1/lib/php:/usr/bin:/tmp:/data/vendor-scripts:/data/sites/web/disabled:/etc/ssl/certs)
I guess this is trying to check if the file exists in the tmp folder. The problem is that it starts from the basepath, which we don't have access to. The root of our shared hosting in this case is 'scribblrmtantwerpeu'
Any way we can fix this?
Hello again! You've mentioned in a readme, that were planning at some point to add other disk drivers support, would +1 an S3 please. We have common "file uploads" going to/serving from s3, but images that require Glide cropping and so on are still on local disk, ideally would like to move all the uploads to Amazon. Not sure though about the best practices regarding cache for example. Have seen a few stackoverflow questions/discussions on having originals on s3, cache on local or disabling cache completely and just serving from s3...
From /Spatie/Glide/Controller/GlideImageController.php
use App\Http\Controllers\Controller;
This assumes that the application namespace is "App", which won't always be the case. When the app namespace has been changed from the default, it causes a fatal error: Class 'App\Http\Controllers\Controller' not found
. I can change it manually, but every time the package is updated, it's going to revert.
Is there anything that can be done about this? Could this be helpful?
https://github.com/laravel/framework/blob/5.0/src/Illuminate/Console/AppNamespaceDetectorTrait.php
Laravel 5.1.7
League \ Glide \ Http \ SignatureException
Signature is not valid.
Can't make it work :'( But it works well without secure URL.
laravel-glide
published and hasn't been changed (using default). Image new.jpg
placed in folder ./storage/images
and folder is writable.
./storage/glide/cache
is writable too. Temporary files directory is writable.
In template I'm just trying to call:
<img src="{{ GlideImage::load('new.jpg') }}">
What could it be?
Hi,
In v2 I did things like:
return GlideImage::load($this->avatar,
['w' => 100, 'h' => 100, 'fit' => 'crop'])->getURL();
But I wanna upgrade to v3, but how to achieve the same? I found out that I had to add the storage_path to the load, but the getURL returns Fatal error: Call to undefined method Spatie\Glide\GlideImage::getURL()
return GlideImage::create(storage_path('app/images/'.$this->avatar),
['w' => 100, 'h' => 100, 'fit' => 'crop'])->getURL();
As far I could see it wasn't possible to use load()
anymore, but the docs still shows it:
https://www.dropbox.com/s/3vbc6d1fd8lch2n/Schermafdruk%202016-02-12%2020.25.12.png?dl=0
is it a default behavior that the svg image background turns to white?
return $server->getImageResponse($path, request()->all());
sample file : https://foodat.ph/img/FoodatWhite.svg
directly linking the file shows an svg image with a transparent background.
original link : https://s3.ap-southeast-1.amazonaws.com/foodat.ph/public/FoodatWhite.svg
i'm using it in an image tag like so
using getImageResponse
<img src='img/FoodatWhite.svg'></img>
direct link
<img src='https://s3.ap-southeast-1.amazonaws.com/foodat.ph/public/FoodatWhite.svg'></img>
explicitly setting the alpha channel to 0 still don't work
img/FoodatWhite.svg?bg=0fff
Thank you
i found error : "Class 'App\Http\Controllers\Dashboard\GlideImage' not found" on laravel 5.4, how to fix it?
The version for the thephpleague/glide
dependency is listed as 0.3.*
.
The 0.3-dev
tag fulfils this requirement but the directory structure of the phpleague library has been changed in this version resulting in this error:
Class 'League\Glide\Api\Manipulator\Orientation' not found in /home/vagrant/Sites/creuset/vendor/spatie/laravel-glide/src/Spatie/Glide/GlideApiFactory.php on line 29
I can confirm that on my php -m imagick is installed properly
I can also use imagick in the terminal.
I have required ext-imagick on my composer.json.
When i try to process an SVG image it fails with this message
Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files.
weird because in my config/image.php
driver is set to imagick.
I don't know why it still keeps using GD and failing because gd does not support svg
here's the actual file
https://foodat.ph/img/FoodatWhite.svg
imagemagick version 7.0.7-25 imagick pecl 3.4.4
you can check my php.ini here
https://foodat.ph/
thank you
Hello everyone !
I'm using your package with these version:
I don't know { how, what, why } this problem or where they from but I think it on the glide package.
I'have try to fix my problem with this link
But nothing that work, so I'm out of solution.
Looks like it's due to this commit: thephpleague/glide@544d51f
Hey @freekmurze, thanks so much for putting this library together. I just wanted to let you know that I just released Glide version 0.3.0. I'll be honest, this release has many breaking changes from version 0.2.x. I apologize for that, but I did want to make all significant changes prior to an eventual 1.0 release. You can find the changelog here.
I will note that I designed version 0.3.0 with Laravel 5 in mind. In fact, Taylor was even kind enough to accept a tweak to the new filesystem adapter in Laravel 5 to to allow access to underlying Flysystem driver. This allows you to use the already configured Flysystem instance with Glide. Here is a rough example:
$this->app->singleton('League\Glide\Server', function ($app) {
$filesystem = $this->app->make('Illuminate\Contracts\Filesystem\Filesystem');
return League\Glide\ServerFactory::create([
'source' => $filesystem->getDriver(),
'cache' => $filesystem->getDriver(),
'source_path_prefix' => 'path/to/source/images',
'cache_path_prefix' => 'path/to/image/cache',
]);
});
Laravel 5 was also a big reason why I added the new source_path_prefix
and cache_path_prefix
options. Normally you would just set this when create your Flysystem
objects, but since you only have one instance available in Laravel 5 you need a way to set the source and cache paths at the Server
level.
You'll also notice that I rearranged the folder structure significantly in this version as well, so there are a bunch of new class names and namespaces. This was a bit painful, but I think it was a good move thinking long term.
Just thought I'd touch base and bring you up to speed on all this! :)
Hello!
First of all thank you for the project, nice one!
Could you advise please, I'm trying to use it with URLs generated from the Angular front-end, dynamically, so not using GlideImage::load
, but something like .../img/image.jpg?w=200
with image urls coming from a model. The problem is in that case I don't have a signature parameter and can't pass the
SignatureFactory::create($this->app['config']->get('app.key'))->validateRequest($request);
validator. So was thinking, maybe the signature should be optional? I believe in Glide they say it's an "additional security feature", I totally understand the purpose, but don't see an easy solution in my case. Do you have any suggestions or workarounds?
Thank you!
Hello, it's a very strict requirement that it needs php 7. My host doesnt support it. The original package of league/glide doesn't need php7 for league/glide 1.0.0. And i wanna use the 1.0.0 leage's glide because of the new features they added.
Hi I Just Downloaded This package and It's not woking I thing many files are missing:
I did all this :
composer require spatie/laravel-glide
And configuration also,
but in the vendor I can't see where is the route config even the laravel-glide.php is empty just the driver gd
I can't see al that config when published. What IM doing wrong ?
Images was out put by php,can't be cached.If I put images in /public directory,output by nginx,it can be cached.
How to fix the problem?
My project is pulling images from a third party, so will not be on any 'local' filesystems.
So I followed all the steps and the image is loaded but with original dimensions.
All my images are in the public folder and from what I can see using a debugger in the GlideServiceProvider, the router is not working. Maybe because my images are not in the storage folder?
Immediatly after install I get the following error when testing in my routes.
FatalErrorException in Facade.php line 218:
Call to undefined method Spatie\Glide\GlideImage::create()
I followed the installation instructions, any idea what I might be doing wrong?
Hi, first of all thanks for your package.
I published the config and modified it to adjust to my project, but when I inspect the HTML I see the glide is generating the URL pointing to img
, also it can't process a load('folder/img.jpg')
, it transforms to folder%2Fimg.jpg
.
Do you know how can I solve those problems?
Thanks!
Packagists show ~14k installs for this package. I'm with a small web-app firm (4 people), and we simply have too much old sites running to port everything to php 7. We'll get there in about 1 year I guess, we have 120 sites running (low traffic).
Our new system is built upon Laravel 5.1, and we like to keep up with new development now. However, getting our vps to php 7 is simply not an option in the nearby future.
We really like this package, and would like to continue using it. I've read tons on the cool new stuff in 7, but for a big package breaking with many people seems like a bad plan!
There is the option of maintaining two branches at the same time. With the Python 2/3 problems, lots of big libraries have tried really hard to be compatible with 2.X and 3.X , none of the big ones did complete dropping of 2.X
Make the syntax a tad less verbose by possibly using these suggestions.
After my issue #62 i updated to verion 3.1.0
I have this in my Config
`
return [
/*
* The driver that will be used to create images. Can be set to gd or imagick.
*/
'driver' => 'gd',
/*
* Glide will search for images in this directory
*
*/
'source' => [
'path' => storage_path('images'),
],
/*
* The directory Glide will use to store it's cache
* A .gitignore file will be automatically placed in this directory
* so you don't accidentally end up committing these images
*
*/
'cache' => [
'path' => storage_path('glide/cache'),
],
/*
* URLs to generated images will start with this string
*
*/
'baseURL' => 'img',
/*
* The maximum allowed total image size in pixels
*/
'maxSize' => 2000 * 2000,
/*
* Glide has a feature to sign each generated URL with
* a key to avoid the visitors of your site to alter the URL
* manually
*/
'useSecureURLs' => true,
];
`
I have image Called foot.jpg in Storage/App/Images
<img src="{{ GlideImage::create('foot.jpg')->modify(['w'=> 200, 'filt'=>'greyscale']) }}" />
but i have this error:
Tried installing this in Laravel 5 and tried using the example usage for displaying an image on the fly. Error is returned.
This is a request. I am working in Lumen but cannot just figure how to get this working. Can you create a package to support Lumen?
hi , how should i implement code in routes.php to process image?
this is my code but it doesnt work
$server = League\Glide\ServerFactory::create([
'source' => 'images/offer',
'cache' => 'images/cache',
]);
Route::match(['get','post'],'img/{other?}', function(\Illuminate\Http\Request $request){
/$server->outputImage($request);
});
Is this going to be fixed for laravel 5?
I follow all install instructions that you saied. and I write a custom Route to show images :
Route::get('/showImage/{w}/{h}/{src}', function (League\Glide\Server $server, Illuminate\Http\Request $request) { $server->outputImage($request); })->where('src', '.+');
but when run the Route bellow error is shown :
BindingResolutionException in Container.php line 745: Target [League\Flysystem\FilesystemInterface] is not instantiable.
Why you dropped on-the-fly image serving support in version 3?
Hello
This package also was shown the photos to enlarge?
like this :
![2]
(https://cloud.githubusercontent.com/assets/10260838/25134427/c502b386-2464-11e7-87da-003ecd28ac70.jpg)
'maxSize' => 12000 * 12000,
I do not want to save the image in any directory and only want to create cache image for some time when user call the Image?
Using Medialibrary, I can successfully modify the media conversions, using setManipulations
in my Model file, for instance orientating thumbnail pic of 90 degrees:
//Post.php
public function registerMediaConversions(){
$this->addMediaConversion('thumb')->setManipulations(['or' => 90])->performOnCollections('images');
}
However, I would like to perform this manipulation on the original media itself, not on the conversion.
In order to do that, I tried to modify my upload controller this way:
//UploadController.php
$post->addMedia($image)->manipulations(['or' => '90'])->toMediaLibrary('images');
But the manipulation doesn't work. Any clue of what I am doing wrong? Is the Glide Api supported only for media conversions?
I want to give height, watermark and I want to make 2 different copies of original images with different size. How to make that?
Does this package work with Laravel 5 route caching ?
I see that there is a closure on router->get…
$this->app['router']->get($glideConfig['baseURL'].'/{all}', function () use ($glideConfig) {
…
})
Hi, this is a great plugin but I can't get it working in Laravel 5.8. Can you provide some updated installation instructions as the video you created was back in 2015. Many thanks.
Since the latest update from v2 I get this errors:
Internention\Image\Exception\NotSupportedException · GET /img/photos/_270_2101912-Foobarjpg_5735a2cb3519a
Driver () could not be instantiated.
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.