Skip to content

Commit c014cd2

Browse files
committed
Rely on core to create pictures directory
1 parent 9dbefe5 commit c014cd2

1 file changed

Lines changed: 4 additions & 24 deletions

File tree

‎lib/GaletteAuto/Picture.php‎

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
namespace GaletteAuto;
1212

13-
use Analog\Analog;
1413
use Galette\Core\Picture as GalettePicture;
1514
use Galette\Core\Plugins;
1615

@@ -36,25 +35,6 @@ public function __construct(Plugins $plugins, mixed $id_adh = null)
3635
{
3736
$this->plugins = $plugins;
3837
$this->store_path = GALETTE_PHOTOS_PATH . '/auto_photos/';
39-
if (!file_exists($this->store_path)) {
40-
if (!mkdir($this->store_path)) {
41-
Analog::log(
42-
'Unable to create photo dir `' . $this->store_path . '`.',
43-
Analog::ERROR
44-
);
45-
} else {
46-
Analog::log(
47-
'New directory `' . $this->store_path . '` has been created',
48-
Analog::INFO
49-
);
50-
}
51-
} elseif (!is_dir($this->store_path)) {
52-
Analog::log(
53-
'Unable to store plugin images, since `' . $this->store_path
54-
. '` is not a directory.',
55-
Analog::WARNING
56-
);
57-
}
5838
parent::__construct($id_adh);
5939
}
6040

@@ -65,12 +45,12 @@ public function __construct(Plugins $plugins, mixed $id_adh = null)
6545
*/
6646
protected function getDefaultPicture(): void
6747
{
68-
$this->file_path = (string)realpath(
69-
$this->plugins->getTemplatesPathFromName('Galette Auto')
70-
. '/../../webroot/images/1f698.png'
71-
);
7248
$this->format = 'png';
7349
$this->mime = 'image/png';
7450
$this->has_picture = false;
51+
$this->setDefaultPath(
52+
$this->plugins->getTemplatesPathFromName('Galette Auto')
53+
. '/../../webroot/images/1f698.png'
54+
);
7555
}
7656
}

0 commit comments

Comments
 (0)