Jens - Hi, I'm trying Twill for the first time ...
# ❓questions
j
Hi, I'm trying Twill for the first time and creating a basic block that has an image will not work for me. After saving and reloading the asset is no longer connected. I was trying to follow the "Building a simple page builder with Laravel Blade" guide but are stuck on Fix the preview-step as I'm not able to render images.

https://cdn.discordapp.com/attachments/811986149064441927/1096425299077501019/Screen_Recording_2023-04-14_at_15.19.44.mov

i
Hi @Jens what's the name of your image field in the block?
j
Copy code
@twillBlockTitle('Text Image')
@twillBlockIcon('text')
@twillBlockGroup('app')

@php
    $selectOptions = [
        [
            'value' => 'left',
            'label' => 'Image | Text'
        ],
        [
            'value' => 'right',
            'label' => 'Text | Image'
        ]
    ];
@endphp


<x-twill::medias
    name="image"
    label="Image"
/>

<x-twill::select
    name="imagePosition"
    label="Image Position"
    placeholder="Select an option"
    :options="$selectOptions"
/>

<x-twill::input
    name="title"
    label="Title"
    :translated="true"
/>

<x-twill::wysiwyg
    name="text"
    label="Text"
    placeholder="Text"
    :toolbar-options="[
        'bold',
        'italic',
        ['list' => 'bullet'],
        ['list' => 'ordered'],
        [ 'script' => 'super' ],
        [ 'script' => 'sub' ],
        'link',
        'clean'
    ]"
    :translated="true"
/>
i
and you didn't make any change to your
twill.php
config file yet, correct?
j
I've added some crops:
Copy code
<?php

return [
    'default_crops' => [
        'page_cover' => [
            'default' => [
                [
                    'name' => 'default',
                    'ratio' => 16 / 9,
                ]
            ]
        ],
    ],
    'block_editor' => [
        'crops' => [
            'square' => [
                'desktop' => [
                    [
                        'name' => 'desktop',
                        'ratio' => 1,
                    ],
                ],
                'mobile' => [
                    [
                        'name' => 'mobile',
                        'ratio' => 1,
                    ],
                ],
            ],
        ],
    ],
];
i
alright, so your image field name should be one of those crops key
if you don't override
block_editor.crops
there is a default
image
key
so to make it work with this configuration you should use
square
as the name of your
medias
field
j
Ah that's much better!
any idea why I'm getting 404's for the image?

https://cdn.discordapp.com/attachments/1096425299345952769/1096427525212753950/image.png

Thanks for you fast response and help! 😄