1
0
mirror of https://github.com/ToxicCrack/PrintABrick.git synced 2025-05-21 06:30:10 -07:00

Fix image loader

This commit is contained in:
David Hübner 2017-05-28 20:05:49 +02:00
parent f4a472998b
commit 1dc5f7f6c5

View File

@ -28,11 +28,9 @@ class ImageLoader extends BaseLoader
* @param $color * @param $color
* @param null $path * @param null $path
*/ */
public function loadColorFromRebrickable($color, $path = null) public function loadColorFromRebrickable($color)
{ {
if (!$path) { $path = $this->rebrickableDownloadUrl."ldraw/parts_{$color}.zip";
$path = $this->rebrickableDownloadUrl."ldraw/parts_{$color}.zip";
}
$file = $this->downloadFile($path); $file = $this->downloadFile($path);
$zip = new \ZipArchive($file); $zip = new \ZipArchive($file);
@ -58,8 +56,8 @@ class ImageLoader extends BaseLoader
$this->initProgressBar(count($models)); $this->initProgressBar(count($models));
foreach ($models as $model) { foreach ($models as $model) {
$this->progressBar->setMessage($model->getNumber()); $this->progressBar->setMessage($model->getId());
if (!$this->mediaFilesystem->has('images'.DIRECTORY_SEPARATOR.'-1'.DIRECTORY_SEPARATOR.$model->getNumber().'.png')) { if (!$this->mediaFilesystem->has('images'.DIRECTORY_SEPARATOR.'-1'.DIRECTORY_SEPARATOR.$model->getId().'.png')) {
try { try {
$this->loadModelImage($this->mediaFilesystem->getAdapter()->getPathPrefix().$model->getPath()); $this->loadModelImage($this->mediaFilesystem->getAdapter()->getPathPrefix().$model->getPath());
} catch (\Exception $e) { } catch (\Exception $e) {