TC
Twill CMSiAlexandru93

Croping not working

Hello guys! I'm using twill 3 for a personal project. I'm facing some issues with croping functionality, I'm using default glide for croping (I did not configured nothing in this direction, not sure if the problem is here) and all my image url's contains the attributes for height and width. The problem is that the image is rendered originally, not croped how I was expected, for example the attached image where the rendered one is not 200x200 px. In admin the media preview works fine, the image is croped. What I'm doing wrong? Thank you for this amazin cms!
No description
K
kallefrombosnia11d ago
Hello. Can you show us how you render the picture (code)? Do you specify crop name as a second param?
I
iAlexandru9310d ago
Hello, @kallefrombosnia, thank you for reply! Sure
I
iAlexandru9310d ago
No description
No description
K
kallefrombosnia10d ago
And your uploaded picture size is? Btw you can controll the w&h by setting params
$item->image('main_banner', 'default', ['w' => 100, 'h' => 100]); // wh- pixels
$item->image('main_banner', 'default', ['w' => 100, 'h' => 100]); // wh- pixels
Also you can check if media exists by
$item->hasImage('main_banner', 'default'); // returns bool
$item->hasImage('main_banner', 'default'); // returns bool
I
iAlexandru9310d ago
669x200 also the croped image in preview looks fine
No description
I
iAlexandru9310d ago
No description
I
iAlexandru9310d ago
thanks for the point, I also tried with fixed width and height but still not working, I'm not sure how this functionality should work, I have changed the parameters into image get url (ex: host/img/f9877556-5ce8-4a01-8b1f-aa7a40fbaaf9/black-friday-super-sale-realistic-black-gifts-boxes-with-golden-bows-dark-background-with-present-boxes-and-golden-percent-symbols-horizontal-banner-poster-header-website-illustration-vector.jpg?fm=jpg&q=80&fit=max&crop=200%2C200%2C297%2C0) and the image it's not croped. The image should be already croped when I access the url directly, no? Also I have added a die into index.php of laravel project and the image request is not going there, the image is accesed directly and rendered from assets folder, pb that's why the image is not croped I took a look into glide documentation and there you have to define assets route in order to be accesed from laravel project and croped by glide plugin. While using glide & twillcms, do I have to define assets route?
I
iAlexandru9310d ago
that's how it looks with fixed width & height
No description
K
kallefrombosnia10d ago
Picture is already cropped from what I can see from your URL. https://glide.thephpleague.com/2.0/api/crop/ <img src="kayaks.jpg?crop=100,100,915,155"> If you see docs for the crop, your example is cropped like 200,200,297,0
Crop - Glide
Wonderfully easy on-demand image manipulation library with an HTTP based API.
I
iAlexandru936d ago
Based on the url yes it should be cropped, but check out the result, it's not 200x200, the rendered image is the one from my picture hello, anybody any idea about how can make the crop works? 😦 @ifox wish you a wonderfull week guys
I
ifox5d ago
Hi @iAlexandru93 glide is already fully setup for you in twill and any request to the /img path (unless you've changed it in configuration) should go through the glide controller and apply the query parameters. Try adding a single parameter to the url to see if the returned image is different than the original. Make sure you haven't defined a route on the /img path.
I
iAlexandru935d ago
Hello, @ifox! Thanks for your reply! It looks like the original image is rendered even if I add any parameter to the url. I added a die in index.php main project file and the die is not executable from image path, so it looks like the image is not rendered via Laravel project, it's rendered directly from assets path. I do not have any route that can overwrite default image path Well, finally I have figured out where the problem was. Thanks for debug! In my case the problem comes out from nginx, I'm using a default nginx config file for docker which was forwarding all .img/png/etc requests to files directly, I just added location /img/ { try_files $uri $uri/ /index.php?$query_string; } and everything works now! thank you guys!
I
ifox5d ago
Ha makes sense, great!
Want results from more Discord servers?
Add your server
More Posts
How can i get another field value in partial balde?$form->add( Input::make()->name('lat')->label('Latitude') ); $form->add(Custom Vue blockI'm encountering an issue while trying to register a custom Vue block following the official guide. Multilingual Imports (3.x)Running into two issues when running a bulk import from (many) xlsx files (on the command line usinUpgrading custom form fields from 2.x to 3.x?I noticed after upgrading Twill to 3.x from 2.x that my custom form fields no longer work. Is there Tags in create modalHello! Is it possible to have Tags input in create modal form? Last time I tried, it threw an error.How to get all data from repository?I wanna get all models from repository and show. How to get all data?How to use random links to browser field?I wanna add random link to browser field. How to do that?DatePicker is not working.I have added DatePicker to form builder. And added column to table, field to model... But when I savSave images in multple sizes for responsive?Hi Support Team, I would like to ask if Twill can store the images in multiple size for desktop, mobHow to display image from InlineRepeaterI want to dispaly the image from InlineRepeater. Please help me how to do it.how to upgrade twil 1.2.1 to latest versionhow to upgrade twil 1.2.1 to latest version twill cmsMulti-Select from Dynamic ValuesI created Location Model. And each location has multiple tags. I want to share tags across differeHow should I migrate from Legacy Settings to V3 Settings?I am having trouble accessing the setting goroup I created. When do php artisan route:list, settingCannot use connectedTo: Cannot unpack array with string keysHi I am having issues getting connectedTo to work in my Block. I have Twill 3.1.0 installed, but whasynchronous request in selectGood afternoon, I have two select fields. The thing is that when selecting the first select field, IUpgraded from Twill 2.13 to 3.2, frontend error when saving a module that uses 'editInModal' => trueI upgraded from Twill 2.13 to 3.2. When saving a module that is created/edited via a modal (using $iUpgraded from Twill 2.13 to 3.2, raw HTML links visible in browserHi, I upgraded from Twill 2.13 to 3.2. I am now seeing raw HTML edit links in my "Projecttags" browHow to use Conditional Fields in ControllerI want to add a Author select fields when shared_by === user ` $form->add( Radios::maBlock editor preview Vite issue?Hey all, I'm getting this when I preview a page module block editor in the admin:Upgrading from 2.0 to 3.0 -Block Editor $groups issueHello! I'm getting a strange error (see picture). I've tried clearing all caches. It only happens on