How to display image from InlineRepeater

I want to dispaly the image from InlineRepeater. Please help me how to do it.
H
HealMan46d ago
Hi, @ifox , Please look at this.
H
HealMan46d ago
I want to display this image in blade. How to do this?
No description
H
HealMan46d ago
<img src="{{ $feature['medias']['image'][0]['original'] }}" /> I can display using this but is there another way?
I
ifox46d ago
$feature->image('image', 'your_crop_name', ['w' => 1000]) w => 1000 is just an example
H
HealMan46d ago
w is sth like index?
I
ifox46d ago
It's width you can pass any param supported by Glide
I
ifox46d ago
Quick reference - Glide
Wonderfully easy on-demand image manipulation library with an HTTP based API.
H
HealMan46d ago
well...
No description
H
HealMan46d ago
$feature is one of features...
H
HealMan46d ago
No description
I
ifox46d ago
How are you saving this repeater? Using a Feature model? Or a JSON column? JSON repeaters do not support medias fields at the moment
H
HealMan46d ago
I don't think we are using Feature model.
I
ifox46d ago
What do you have in the repository class of the module where you are using this inline repeater field?
H
HealMan46d ago
No description
I
ifox46d ago
Ok, so JSON repeater. You cannot use medias fields when saving a repeater using $jsonRepeaters. You should use $repeaters in the repository, a features hasMany relationship in your Location model, pointing to a Feature model which uses HasMedias. That way you can use ->image like I said above. OR, if you don't want to deal with any of that, use a features block in a block_editor field. You won't have to create another model and deal with migrations etc...
H
HealMan46d ago
I see.
I
ifox46d ago
A lot of users are trying to use medias fields in JSON repeaters though, and we are going to look into it. Just so you know, the reason it is not supported is because we do not want to store a media reference in a model JSON column, we want all media references to be stored in the mediables table so we can know exactly where a specific image is being used in the content. I have an idea in mind to do that though, so we'll look into it.
H
HealMan46d ago
Great! And I have a problem with storing images.
H
HealMan46d ago
No description
No description
H
HealMan46d ago
it shows that content saved but after refresh, image is blank.
I
ifox46d ago
Yes, because JSON repeaters do not store attached medias. If you save it using an actual relationship it would work.
H
HealMan46d ago
well... then what about this? when I name the medias as 'hightlight' it shows the saved content but when I change name to anything like 'image' or 'images', it doesn't show the saved content.
No description
H
HealMan46d ago
And this is block... I used this block inside of another model using Block Editor.
I
ifox46d ago
If you change the name after saving, that's expected. If not, it could be a conflict with other crop configurations in your project, but that shouldn't prevent saving and retrieving it.
H
HealMan46d ago
well.. I only configured crop in twill.php.
H
HealMan46d ago
inside of crops... I have 'highlight', is this something prevent me to name medias input other than 'highlight'?
No description
I
ifox46d ago
no, it doesn't prevent it, but if you want to use something other than highlight, you should also define a key for that in the crops array There is a default crop configuration if you use 'image' as the crop name, but most likely you need to apply your own configuration
H
HealMan46d ago
so if we have 3 different Medias Name? then I should have 3 itmes in crops array?
I
ifox46d ago
yes, exactly. but you can reuse the same medias name across multiple blocks
H
HealMan46d ago
That makes sense. Thank you very much for your help. So regarding features repeater, I need to create feature block and use it in location. And do I need to use Block Editor? or is there other way that I can use feature block without Block Editor?
I
ifox46d ago
Yeah blocks are used within the block editor field. The only difference really with a repeater from a UX perspective is that if your block editor has a single possible block, the user needs to click twice instead of once to add an item (first on the add button then on the name of the block in the list). but like I said, we are looking into supporting medias fields in the repeater json column approach.
H
HealMan46d ago
Okay, Sounds great! So right now to use feature block, I have to create a new block. And I have to insert Block Editor to Location. Block Editor can add any block but how can I make Feature Block only available for that Block Editor?
I
ifox45d ago
'blocks' => [FeatureBlock::class] on the block editor field
Want results from more Discord servers?
Add your server
More Posts
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 onInline Repeater get's overridden by another InlineRepeater with the same name in another block.The code in first image get's overriden by the code in the second image in admin panel. Normally, whTable custom columnHello! I created module Product and relationship with module Category. I would like to display categMulti select selected issueIn twill3 I created 2 CRUD, ImportedItem and ItemTypes. I used Multiselect for selecting ItemTypes. Upgrading from 2.0 to 3.0 - routing issuesHello! I'm currently updating twill to 3.0 from 2.0, and I'm having some issues with routes. I'm getDisabled defaults in controller based on user RoleGroupI want to disable, create, edit or delete actions according to user RoleGroup or there is another waDrag and drop issueHello, any idea how to achive DnD working on modules list. Problem is in that when you go below limiFile library 404 errorHello, I'm encountering issues with the file library. When I upload a file, such as a .txt file, it'InlineRepeater deleting data on related Model entriesI'm using an InlineRepeater to add relations with pivot data between two Repositories. The relations"astrotomic/laravel-translatable" n+1 queriesI've got a package issue which is composer required by twill. 800+ queries on a model only getting Repeaters and Blockeditor won't work with media library.I saw the pst regarding JSON repeaters. So I switched to the block editor for the content that NEEDS