i have inserted image through laravel voyager and it is successfully inserted inside database but it is not showing in laravel voyager .....can someone help me
@aamirkhan37557 You need to setup APP_URL in .env.
How to work work with image intervention in voyager admin panel
I have displayed images on front end but how would I resize it through image intervention in admin panel in voyager
As I know there is no that option yet , probably it will be added in feature versions.
What you can do is setup different thumbnail and cropped versions in admin panel , you can check how to do that here , scroll down to Images.
So when you upload image it will generate different versions of that image so you can use resized/cropped version in front.
My PR for accessing thumbnail versions is accepted , but you can create helper function for yourself, like this:
function thumbnail($image , $type)
{
// We need to get extension type ( .jpeg , .png ...)
$ext = pathinfo($image, PATHINFO_EXTENSION);
// We remove extension from file name so we can append thumbnail type
$name = rtrim($image, '.'. $ext);
// We merge original name + type + extension
return $name . '-' . $type . '.' . $ext;
}
Where did I will create this helper function In the model of image or where?
You can create file for all your helpers.
I usually create new folder Support in /app and create file helpers.php
Then you need to update composer.json to add it:
"autoload": {
"classmap": [
...
],
"psr-4": {
"App\\": "app/"
},
"files": [
"app/helpers.php" // <---- ADD THIS
]
},
then you need to:
composer dump-autoload
@emchooo APP_URL is not reliable,
for website host both http and https APP_URL is not change the proper protocol for the request
for example:
APP_URL=http://homestead.dev
and in the page https://homestead.dev/admin/media still is http://homestead.dev/storage/users/default.png etc.
can you recomend me some guide line how to create a helper class in voyager and how to use them any notes or video or something else?
@ryh How about localhost, do you have some guidelines for this?
Labels: feature, question
You can use Resizeable Trait in Voyager 1.0.11 See #2422
{{ Voyager::image( $yourvariable->image ) }}
how to display all images that are on a voyager folder
Most helpful comment
@aamirkhan37557 You need to setup APP_URL in .env.