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

public getName ( ) : string
Результат string name of the file
Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function resize(MediaInterface $media, File $in, File $out, $format, array $settings)
 {
     if (!isset($settings['width'])) {
         throw new \RuntimeException(sprintf('Width parameter is missing in context "%s" for provider "%s"', $media->getContext(), $media->getProviderName()));
     }
     $image = $this->adapter->load($in->getContent());
     $size = $media->getBox();
     if (null != $settings['height']) {
         if ($size->getHeight() > $size->getWidth()) {
             $higher = $size->getHeight();
             $lower = $size->getWidth();
         } else {
             $higher = $size->getWidth();
             $lower = $size->getHeight();
         }
         $crop = $higher - $lower;
         if ($crop > 0) {
             $point = $higher == $size->getHeight() ? new Point(0, 0) : new Point($crop / 2, 0);
             $image->crop($point, new Box($lower, $lower));
             $size = $image->getSize();
         }
     }
     $settings['height'] = (int) ($settings['width'] * $size->getHeight() / $size->getWidth());
     if ($settings['height'] < $size->getHeight() && $settings['width'] < $size->getWidth()) {
         $content = $image->thumbnail(new Box($settings['width'], $settings['height']), $this->mode)->get($format, array('quality' => $settings['quality']));
     } else {
         $content = $image->get($format, array('quality' => $settings['quality']));
     }
     $out->setContent($content, $this->metadata->get($media, $out->getName()));
 }
 /**
  * {@inheritdoc}
  */
 public function resize(MediaInterface $media, File $in, File $out, $format, array $settings)
 {
     if (!isset($settings['width'])) {
         throw new \RuntimeException(sprintf('Width parameter is missing in context "%s" for provider "%s"', $media->getContext(), $media->getProviderName()));
     }
     $image = $this->adapter->load($in->getContent());
     $content = $image->thumbnail($this->getBox($media, $settings), $this->mode)->get($format, array('quality' => $settings['quality']));
     $out->setContent($content, $this->metadata->get($media, $out->getName()));
 }
 /**
  * Resize Image Media file. Sizes is based on ImageSizes class.
  * @param Media $media
  * @param array $sizes 
  * @param bool $forceCrop
  */
 function resize(Media $media, $sizes = array(), $forceCrop = true)
 {
     if (count($sizes)) {
         $in = new File($media->getName(), $this->filesystem);
         $fileArr = explode(".", $in->getName());
         $format = array_pop($fileArr);
         if (!$forceCrop) {
             $this->resizer->setModeToInset();
         }
         foreach ($sizes as $each) {
             $out = new File($each . '_' . $media->getName(), $this->filesystem);
             $imageSize = ImageSizes::toArray($each);
             $this->resizer->resize($media, $in, $out, $format, $imageSize);
         }
     }
 }
Пример #4
0
 public function getExtension()
 {
     return pathinfo($this->file->getName(), PATHINFO_EXTENSION);
 }
Пример #5
0
 /**
  * {@inheritdoc}
  */
 public function getName()
 {
     return $this->file->getName();
 }