initial
This commit is contained in:
@@ -10,7 +10,7 @@ namespace CarManagerV2
|
||||
internal class ImageManager
|
||||
{
|
||||
|
||||
public static void initializeImageFolder()
|
||||
public static void InitializeImageFolder()
|
||||
{
|
||||
string path = "images";
|
||||
if (!System.IO.Directory.Exists(path))
|
||||
@@ -19,7 +19,7 @@ namespace CarManagerV2
|
||||
}
|
||||
}
|
||||
|
||||
public static string getImagePath(Car car)
|
||||
public static string GetImagePath(Car car)
|
||||
{
|
||||
string basePath = "images/";
|
||||
string fileName = $"{car.Make}_{car.Model}_{car.Year}_{car.Color}.png";
|
||||
@@ -28,9 +28,9 @@ namespace CarManagerV2
|
||||
|
||||
public static Image GetImage(Car car)
|
||||
{
|
||||
initializeImageFolder();
|
||||
fetchImage(car);
|
||||
string path = getImagePath(car);
|
||||
InitializeImageFolder();
|
||||
FetchImage(car);
|
||||
string path = GetImagePath(car);
|
||||
// does image exist?
|
||||
if (System.IO.File.Exists(path))
|
||||
{
|
||||
@@ -43,13 +43,13 @@ namespace CarManagerV2
|
||||
|
||||
}
|
||||
|
||||
public static void fetchImage(Car car)
|
||||
public static void FetchImage(Car car)
|
||||
{
|
||||
// Fetch the image from https://cdn.imagin.studio/getimage and save it to images/Make_Model_Year.webp
|
||||
// use params like this: ?customer=hrjavascript-mastery&zoomType=fullscreen&make={make}&modelFamily={model}&modelYear={year}&angle=front&paintDescription={color}&fileType=png
|
||||
|
||||
// check if the image already exists
|
||||
string path = getImagePath(car);
|
||||
string path = GetImagePath(car);
|
||||
if (System.IO.File.Exists(path))
|
||||
{
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user