/** * Make a new photo instance from an uploaded file * * @var $file * @return self */ public static function fromForm($file) { $photo = new static(); $photo->file = $file; $photo->name = $photo->fileName(); return $photo->fill(['path' => $photo->filePath(), 'thumbnail_path' => $photo->thumbnailPath()]); }
public static function fromFileWithEvent(UploadedFile $file, Event $event) { $photo = new static(); $photo->file = $file; $photo->event = $event; $photo->eventInfo = $photo->buildEventArray($photo->event->name, $photo->event->date_start); return $photo->fill(['name' => $photo->fileName(), 'path' => $photo->filePath(), 'thumbnail_path' => $photo->thumbnailPath(), 'event_main' => 0]); }
public function fromFile(UploadedFile $file) { $photo = new static(); $photo->file = $file; return $photo->fill(['name' => $photo->fileName(), 'path' => $photo->filePath(), 'thumbnail_path' => $photo->thumnailPath()]); }
/** * Make a placeholder image from a file * @return placeholder */ public static function fromFile(UploadedFile $file) { $placeholder = new static(); $placeholder->file = $file; return $placeholder->fill(['name' => $placeholder->fileName(), 'path' => $placeholder->filePath(), 'thumbnail_path' => $placeholder->thumbnailPath(), 'width' => $placeholder->getWidth(), 'height' => $placeholder->getHeight()]); }