public function store(File $file, $path) { $response = $this->upload($file->getPathname(), $path); // Resolves to upload path, e.g. users/1/adsadasd.jpg $file->setName(sprintf('%s.%s', $response['public_id'], $file->getExtension())); $file->setUrl($response['secure_url']); // Set the type here, otherwise getType will be called after the temp // file has been deleted. $file->setType($response['resource_type'] === 'image' ? 'image' : 'file'); if (!isset($this->config['editions']) || !is_array($this->config['editions'])) { $this->config['editions'] = []; } $thumbnailsConfig = $this->uploaderConfig->get('thumbnails'); $this->config['editions']['thumbnail'] = ['crop' => $thumbnailsConfig['crop'], 'height' => $thumbnailsConfig['height'], 'width' => $thumbnailsConfig['width']]; foreach ($this->config['editions'] as $key => $edition) { $edition = new Edition($key, null, $path, ['type' => 'image', 'height' => $edition['height'], 'width' => $edition['width'], 'crop' => $edition['crop'], 'cloudinary_response' => $response], false); $url = $this->resolveUrl($edition); $edition->setUrl($url); $file->addEdition($edition); } return $file; }