trntv / yii2-glide Goto Github PK
View Code? Open in Web Editor NEWYii2 Glide integration component
Home Page: http://github.com/trntv/yii2-starter-kit
License: BSD 3-Clause "New" or "Revised" License
Yii2 Glide integration component
Home Page: http://github.com/trntv/yii2-starter-kit
License: BSD 3-Clause "New" or "Revised" License
Hi
glide have this function
https://glide.thephpleague.com/2.0/config/source-and-cache/#deleting-cached-images
now i use it?
I need to send headers like expires, or cache-control. How I can do this?
Get error in logs after view image
yii\web\HeadersAlreadySentException: Headers already sent in /var/www/localhost/vendor/league/glide/src/Server.php on line 477. in /var/www/localhost/vendor/yiisoft/yii2/web/Response.php:366
Stack trace:
#0 /var/www/localhost/vendor/yiisoft/yii2/web/Response.php(339): yii\web\Response->sendHeaders()
#1 /var/www/localhost/vendor/yiisoft/yii2/base/Application.php(392): yii\web\Response->send()
#2 /var/www/localhost/web/index.php(12): yii\base\Application->run()
#3 {main}
There are several fixes since 1.2.0
. Including a critical error thrown on every request since 2.0.14
in #21 (not yet accepted). Could you bump the version of yii2-glide
?
Делаем url вида: [ 'pattern'=>'/cache/<w:([0-9]+)>/<h:([0-9]+)>/<q:([0-9]+)>/fit:(crop)/crop:(center)/path:(.*)',
'route'=>'glide/index', 'encodeParams' => false]
и кэш складировать по этому пути.
Если такое возможно подскажите как это можно сделать.
Похоже надо поправить зависимость
Composer\DependencyResolver\SolverProblemsException] Problem 1 - league/uri 5.x-dev requires league/uri-components ^1.8 -> no matching package found. - trntv/yii2-glide 1.2.2 requires league/uri ^5.0 -> satisfiable by league/uri[5.x-dev]. - Installation request for trntv/yii2-glide ^1.0
some time. glide load a not exist image or a eeror image , then show a default image.
when config the glide , can set the defualt image path
thank you
Hi. If I change any photo and show this with glide, I see old image until manually delete cache file.
Here is issue thephpleague/glide#7 about this, and method deleteCache
now in library code.
I think, if You update a league/glide
version in composer.json
, and all will work out the box. Or, may be, such method already exists, and I do not know about this?
P.S. Thank You for great extension, and sorry my terrible English :)
Good afternoon!
First of all thanks for you work with your extension!
I have some non-trivial problem.
My trntv/yii2-glide version is 1.3.0
PHP 7.1.16
CentOS
using CloudFlare
My problem with displaying images with resized image more than 192px
Next screen video will eloquently explain the problem - http://i.de-v.net/1524404756.webm
As you can see image is creating and shows on the page but after ~5 second it disappears.
Running code
return \yii\helpers\Html::img(
Yii::$app->glide->createSignedUrl([
'glide/index',
'path' => $model->uploadedProductPictures[0]->picture_path,
'w' => 500
], true)
);
Configurations
'controllerMap' => [
'glide' => '\trntv\glide\controllers\GlideController'
]
...
'glide' => [
'class' => 'trntv\glide\components\Glide',
'sourcePath' => '@storage/source',
'cachePath' => '@storage/cache',
'maxImageSize' => 4000000,
'signKey' => 'IsOOUu_ixnoxqrx6jN34IF7TL25yWuT3'
]
...
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules'=> [
['pattern'=>'cache/<path:(.*)>', 'route'=>'glide/index', 'encodeParams' => false]
]
]
...
Browser log
t=66267 [st=46025] HTTP2_STREAM_ERROR
—> description = "Server reset stream."
—> net_error = "ERR_SPDY_PROTOCOL_ERROR"
—> stream_id = 1
t=66267 [st=46025] -HTTP_TRANSACTION_READ_BODY
—> net_error = -337 (ERR_SPDY_PROTOCOL_ERROR)
t=66267 [st=46025] FAILED
—> net_error = -337 (ERR_SPDY_PROTOCOL_ERROR)
t=66267 [st=46025] -REQUEST_ALIVE
—> net_error = -337 (ERR_SPDY_PROTOCOL_ERROR)
I have tested with different browsers, computers and networks.
If 'w' (width) parameter less than 192px - working fine.
If i disabling ssl and CloudFlare - also working fine.
Please, advise me with this problem.
Thank you in advance.
for croping image from domains like facebook, google without storing.
Since Glide Version 0.3 is no longer actively maintained.
And Version 1.0 offers many new features.
Thanks!
Conclusion: remove symfony/http-foundation v4.2.4
I developed a web app using yii2-starter-kit with yii2-glide, but our security testing engineer told me it is not safe to allow guest to download files.
I have tried to add globalAccess
in file storage/config/base.php
`
'as globalAccess'=>[
'class'=>'\common\behaviors\GlobalAccessBehavior',
'rules'=>[
[
'controllers'=>['glide'],
'allow' => true,
'roles' => ['@'],
'actions'=>['index']
],
]
]
`
I also tried to add code in vendor/trntv/yii2-glide/src/controllers/GlideController.php
public function behaviors() { return [ 'access' => [ 'class' => AccessControl::className(), 'only' => ['index'], 'rules' => [ [ 'allow' => true, 'actions' => ['index'], 'roles' => ['@'], ], ], ], ]; }
neither worked
Install manual and Readme has no information about required php extensions – php-exif, for example (and I don`t know, what else).
Glide install manual also has no information, and NotSupportedExeption
in actions\GlideAction
doesn’t show, why not supported :)
It would be better to add all of this in documentation.
Hi @trntv ,
I have an image that is 1280 x 300 but I want to crop and use only the leftmost 400 pixels and retain the same height so that the final image becomes 400 x 300 without distortion so I setup the Glide URL as follows but the dimensions didn't change at all, what am I doing wrong?
$imageUrl = Yii::$app->glide->createSignedUrl([
'glide/index',
'path' => $model->image_path,
'w' => 400,
'h' => 300,
'fit' => 'fill'
], true);
I also tried 'fit' => 'crop', none worked
Thanks for your help.
Adam
К примеру при реализации клиентского кропа у меня есть координаты картинки x1,x2,y1,y2,h,w
возможно ли вывести картинку по ним?
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.