From f70276fd5146ac3fa290aa8bd33e0e1697705fe1 Mon Sep 17 00:00:00 2001 From: axlan Date: Fri, 25 Nov 2022 19:11:45 -0800 Subject: [PATCH 1/4] Add special case in imageURL for loading local images. --- js/creator-23.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/creator-23.js b/js/creator-23.js index 1a66b0d5..d0fd896d 100644 --- a/js/creator-23.js +++ b/js/creator-23.js @@ -2190,7 +2190,10 @@ function setRoundedCorners(value) { //Various loaders function imageURL(url, destination, otherParams) { var imageurl = url; - if (params.get('noproxy') != '') { + // If an image URL does not have HTTP in it, assume it's a local file at the HTML root directory. + if (!url.includes('http')) { + imageurl = '/' + url; + } else if (params.get('noproxy') != '') { //CORS PROXY LINKS //Previously: https://cors.bridged.cc/ imageurl = 'https://api.codetabs.com/v1/proxy?quest=' + url; From 29c0fc2612f82720f1a5113ecafa8c71faaad59f Mon Sep 17 00:00:00 2001 From: axlan Date: Fri, 25 Nov 2022 19:21:21 -0800 Subject: [PATCH 2/4] Switch to using dedicated directory. --- js/creator-23.js | 2 +- local_art/.gitignore | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 local_art/.gitignore diff --git a/js/creator-23.js b/js/creator-23.js index d0fd896d..db62c1a5 100644 --- a/js/creator-23.js +++ b/js/creator-23.js @@ -2192,7 +2192,7 @@ function imageURL(url, destination, otherParams) { var imageurl = url; // If an image URL does not have HTTP in it, assume it's a local file at the HTML root directory. if (!url.includes('http')) { - imageurl = '/' + url; + imageurl = '/local_art/' + url; } else if (params.get('noproxy') != '') { //CORS PROXY LINKS //Previously: https://cors.bridged.cc/ diff --git a/local_art/.gitignore b/local_art/.gitignore new file mode 100644 index 00000000..d6b7ef32 --- /dev/null +++ b/local_art/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore From 70737200861e066c139c32817e2dbaceeec4af46 Mon Sep 17 00:00:00 2001 From: axlan Date: Fri, 25 Nov 2022 19:36:54 -0800 Subject: [PATCH 3/4] Update comment. --- js/creator-23.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/creator-23.js b/js/creator-23.js index db62c1a5..64ccf90c 100644 --- a/js/creator-23.js +++ b/js/creator-23.js @@ -2190,7 +2190,7 @@ function setRoundedCorners(value) { //Various loaders function imageURL(url, destination, otherParams) { var imageurl = url; - // If an image URL does not have HTTP in it, assume it's a local file at the HTML root directory. + // If an image URL does not have HTTP in it, assume it's a local file in the repo local_art directory. if (!url.includes('http')) { imageurl = '/local_art/' + url; } else if (params.get('noproxy') != '') { From 2bb6aadbb20092b285caa9bd79d6baa52fdac0e1 Mon Sep 17 00:00:00 2001 From: axlan Date: Sat, 10 Dec 2022 17:29:27 -0800 Subject: [PATCH 4/4] Added update to README for using local images. --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 97e44669..9c537de0 100644 --- a/README.md +++ b/README.md @@ -81,3 +81,16 @@ http://localhost:4242/ ### Important Be sure, that you are running Docker Desktop under Windows or Mac before you can run the make command. + +## Using Local Images + +If you're saving a lot of cards custom images you might hit the data limit for uploaded images (about 2MB). + +You can avoid this by putting the image files in the `local_art` directory of this repo. Then, when selecting the image in the Art tab of the card creator, instead of uploading the image you can type the file name in the "Via URL" field. This will use the image directly from the `local_art` directory instead of needing to store the whole image in the save file. + +For example if you add the file: +`cardconjurer/local_art/my_art.jpg` + +You can load it in the "Via URL" box by typing: +`my_art.jpg` +then hitting enter.