protected function saveImage($image, $type = null)
{
if ($type == null) {
throw new Exception("Please specify a type image");
}
$img = Image::make($image->getRealPath());
if ($type == 'series') {
$img->fit(self::$seriesWidth, self::$seriesHeight);
$filepath = $this->randomSeriesPath($image->getClientOriginalExtension());
} else {
if ($type == 'category') {
$img->fit(self::$cateWidth, self::$cateHeight);
$filepath = $this->randomCatePath($image->getClientOriginalExtension());
}
}
$img->save($this->getFullpath($filepath));
return $filepath;
}