Esempio n. 1
0
 /**
  * @param string $fileUrl
  * @param string $localFilePath
  * @return bool|void
  */
 protected function retrieveRemoteImage($fileUrl, $localFilePath)
 {
     $this->curl->setConfig(['header' => false]);
     $this->curl->write('GET', $fileUrl);
     $image = $this->curl->read();
     $this->fileUtility->saveFile($localFilePath, $image);
 }
Esempio n. 2
0
 /**
  * Extend the original functionality of this method by also uploading the
  * requested file to S3.
  *
  * @param string $filePath
  * @param string $content
  * @param bool $overwrite
  * @return bool
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function saveFile($filePath, $content, $overwrite = false)
 {
     $result = parent::saveFile($filePath, $content, $overwrite);
     if ($result) {
         $this->fileStorageDb->saveFile($filePath);
     }
     return $result;
 }
Esempio n. 3
0
 /**
  * @param string $fileUrl
  * @param string $localFilePath
  * @return void
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 protected function retrieveRemoteImage($fileUrl, $localFilePath)
 {
     $this->curl->setConfig(['header' => false]);
     $this->curl->write('GET', $fileUrl);
     $image = $this->curl->read();
     if (empty($image)) {
         throw new \Magento\Framework\Exception\LocalizedException(__('Could not get preview image information. Please check your connection and try again.'));
     }
     $this->fileUtility->saveFile($localFilePath, $image);
 }