G
G
GrimJack2017-08-13 22:53:24
Laravel
GrimJack, 2017-08-13 22:53:24

theorchid image loader?

I can't figure out how to set the thumbanial field for posts. Well, in fact, the button to download the picture. There is UploadPostForm::class but it is essentially more for the gallery.
Tried like this

'thumb'        => 'tag:input|type:file|name:thumb|title:Изображение поста',

However, this crashes the system with an error
htmlspecialchars() expects parameter 1 to be string, array given (View: /var/www/portal/vendor/orchid/platform/resources/views/fields/input.blade.php) (View: /var/www/portal/vendor/orchid/platform/resources/views/fields/input.blade.php)

Actually the question is, is there anything similar in orchid?
Or write your own field and inherit from the file loader in orchid?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Alexandrovich, 2017-08-14
@tatu

Use the standard uploader, you can upload multiple images and sort them (Drag and Drop)
And make the first image the main one and display it.

//low - разрешение которое необходимо, регистрируется в файле конфигурации
$post->attachment->first()->url('low');

//Если содержится не только изображения, но и файлы для загрузки
//можно уточнить, что выбирать нужно, только из изображений
$post->attachment('image')->first()->url('low');

If this method, well, doesn’t suit you, then you can transfer the image in base64, then there will be no errors

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question