I am new to symfony2. I use liipImagineBundle to control image thumbnail. I have a product object class that uses Lifecycle callbacks to manage the product image.
product.php
<?php namespace Svipl\AdminBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as GEDMO; use Symfony\Component\HttpFoundation\File\UploadedFile; class Product{ private $id; private $name; private $description; private $price; private $updated_at; private $created_at; protected $category; private $image; public function getAbsolutePath() { return null === $this->image ? null : $this->getUploadRootDir().'/'.$this->image; } public function getWebPath() { return null === $this->image ? null : $this->getUploadDir().'/'.$this->image; } protected function getUploadRootDir() {
config.yml
... liip_imagine: filter_sets: my_thumb: quality: 75 filters: thumbnail: { size: [120, 90], mode: outbound }
Thumbnail Generation Code
... <img src="{{ asset('uploads/product/' ~ form_object.vars.value.image) | imagine_filter('my_thumb', true) }}" /> ...
Sketches are created correctly.
But I canβt find a way to update / delete the cached image on the first change of the image or delete using the form.
php symfony liipimaginebundle
Hardeep pandya
source share