deleteImageVariations() публичный Метод

Remove all metadata about image variations for an image
public deleteImageVariations ( string $user, string $imageIdentifier, integer $width = null ) : boolean
$user string The user which the image belongs to
$imageIdentifier string The image identifier
$width integer Only delete the variation with this width
Результат boolean
Пример #1
0
 public function testCanDeleteAllTransformations()
 {
     $variations = [['width' => 770, 'height' => 564], ['width' => 385, 'height' => 282], ['width' => 192, 'height' => 140]];
     foreach ($variations as $variation) {
         $this->assertTrue($this->adapter->storeImageVariationMetadata('key', 'id', $variation['width'], $variation['height']));
     }
     $this->assertTrue($this->adapter->deleteImageVariations('key', 'id'));
     $this->assertSame(null, $this->adapter->getBestMatch('key', 'id', 100));
 }
Пример #2
0
 /**
  * Delete all image variations attached to an image
  *
  * If any of the delete operations fail Imbo will trigger an error
  *
  * @param EventInterface $event The current event
  */
 public function deleteVariations(EventInterface $event)
 {
     $request = $event->getRequest();
     $publicKey = $request->getPublicKey();
     $imageIdentifier = $request->getImageIdentifier();
     try {
         $this->database->deleteImageVariations($publicKey, $imageIdentifier);
     } catch (DatabaseException $e) {
         trigger_error(sprintf('Could not delete image variation metadata for %s (%s)', $publicKey, $imageIdentifier), E_USER_WARNING);
     }
     try {
         $this->storage->deleteImageVariations($publicKey, $imageIdentifier);
     } catch (StorageException $e) {
         trigger_error(sprintf('Could not delete image variations from storage for %s (%s)', $publicKey, $imageIdentifier), E_USER_WARNING);
     }
 }