PHP code example of marshmallow / nova-advanced-image
1. Go to this page and download the library: Download marshmallow/nova-advanced-image library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
marshmallow / nova-advanced-image example snippets
namespace App\Nova;
// ...
use Marshmallow\AdvancedImage\AdvancedImage;
class Post extends Resource
{
// ...
public function fields(Request $request)
{
return [
// ...
// Simple image upload
AdvancedImage::make('photo'),
// Show a cropbox with a free ratio
AdvancedImage::make('photo')->croppable(),
// Show a cropbox with a fixed ratio
AdvancedImage::make('photo')->croppable(16 / 9),
// Resize the image to a max width
AdvancedImage::make('photo')->resize(1920),
// Resize the image to a max height
AdvancedImage::make('photo')->resize(null, 1080),
// Show a cropbox and resize the image
AdvancedImage::make('photo')->croppable()->resize(400, 300),
// Auto-rotate based on the image's Exif orientation (
use Marshmallow\AdvancedImage\AdvancedAvatar;
AdvancedAvatar::make('avatar')->croppable(1),
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.