PHP code example of onadrog / imageconverterbundle

1. Go to this page and download the library: Download onadrog/imageconverterbundle 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/ */

    

onadrog / imageconverterbundle example snippets


// src/Entity/Foo.php
namespace App\Entity;

// ...
use Onadrog\ImageConverterBundle\Mapping\Attribute as Onadrog;

/**
 * @ORM\Entity(repositoryClass=FooRepository::class)
 */
#[Onadrog\ImageUpload]
class Foo
{
    // ...

    private $fileName;

    private $fileSlug;

    /**
     * @ORM\Column(type="json")
     */
    private ?array $fileDimension = [];

     /**
     * @ORM\Column(type="json")
     */
    private ?array $mimeTypes = [];

    private  $fileAlt;

    #[Onadrog\ImageUploadProperties(name: 'fileName', slug: 'fileSlug', alt: 'fileAlt', dimension: 'fileDimension', mimeTypes: 'mimeTypes')]
    private $file;
}

// src/Form/FooType.php

namespace App\Foo\Form;

// ...
use Onadrog\ImageConverterBundle\Form\Type\ImageConverterType;

class FooType extends AbstractType
{
    //..
    public function builForm(FormBuilder $builder, array $options)
    {
        // ...

        $builder->add('file', ImageConverterType::class);
    }
}