/** * @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); }
/** * @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); }