public function storeImageToTempPath(AlvineImage $image, $skipIdExists = true) { $destination = $this->imageTempDir . $image->getName(); if ($skipIdExists && is_file($destination)) { return filesize($destination); } $imageContent = @file_get_contents($image->getUrl()); if ($imageContent === false) { throw new Exception("unable to fetch image " . $image->getUrl()); } return file_put_contents($destination, $imageContent); }
public static function detailImage(AlvineImage $image) { return ['disabled' => 0, 'position' => 99, 'label' => $image->getName(), 'filename' => $image->getName(), 'url' => $image->getUrl()]; }