/** * Create the database entry for an image. * * @param File $image * @param array $attributes * @return Image */ protected function createImageRecord(File $image, array $attributes = []) { // Obtain image metadata and save the record to the database. $imageData = new ImageData($image, $this->intervention->make($image->getRealPath())); $attributes = array_merge($attributes, ['width' => $imageData->getWidth(), 'height' => $imageData->getHeight(), 'average_color' => $imageData->getAveragePixelColor(), 'mime_type' => $image->getMimeType()]); return $this->imageRepository->create($attributes); }