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

If storage driver does not support absolute paths (cloud storage) returns file key
public getAbsolutePath ( ) : string
Результат string
Пример #1
0
 /**
  * Android and Iphone images are sometimes rotated "incorrectly".
  * This method fixes that.
  * Method is called automatically on the `open` method.
  *
  * @param File      $imageFile
  * @param ImageInterface $image
  */
 private static function fixImageOrientation(File $imageFile, ImageInterface $image)
 {
     $format = $image->getFormat();
     // exif data is available only on jpeg and tiff
     // tiff is ignored, because smartphones don't produce tiff images
     if ($format == 'jpg' || $format == 'jpeg') {
         $exifData = exif_read_data($imageFile->getAbsolutePath(), 'IFDO');
         if (isset($exifData['Orientation'])) {
             switch ($exifData['Orientation']) {
                 case 3:
                     $rotation = 180;
                     break;
                 case 6:
                     $rotation = 90;
                     break;
                 case 8:
                     $rotation = -90;
                     break;
                 default:
                     $rotation = 0;
                     break;
             }
             if ($rotation != 0) {
                 $image->rotate($rotation);
             }
         }
     }
 }
Пример #2
0
 /**
  * Creates a new ImageInterface instance from the given image at the provided path.
  *
  * @param File $image Path to an image on the disk.
  *
  * @return \Webiny\Component\Image\ImageInterface
  */
 public function open(File $image)
 {
     return new Image($this->instance->open($image->getAbsolutePath()));
 }
Пример #3
0
 /**
  * Attach a file to your message.
  *
  * @param File $file     File instance
  * @param string    $fileName Optional name that will be set for the attachment.
  * @param string    $type     Optional MIME type of the attachment
  *
  * @return $this
  */
 public function addAttachment(File $file, $fileName = '', $type = 'plain/text')
 {
     $this->message->addAttachment($file->getAbsolutePath(), $fileName);
     return $this;
 }