Merge pull request #2 from axlan/local-image-hack

Add special case to imageURL for loading local images.
This commit is contained in:
Chris McGuire
2022-12-15 19:24:57 -06:00
committed by GitHub
3 changed files with 19 additions and 1 deletions

View File

@@ -81,3 +81,16 @@ http://localhost:4242/
### Important ### Important
Be sure, that you are running Docker Desktop under Windows or Mac before you can run the make command. 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.

View File

@@ -2190,7 +2190,10 @@ function setRoundedCorners(value) {
//Various loaders //Various loaders
function imageURL(url, destination, otherParams) { function imageURL(url, destination, otherParams) {
var imageurl = url; var imageurl = url;
if (params.get('noproxy') != '') { // 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') != '') {
//CORS PROXY LINKS //CORS PROXY LINKS
//Previously: https://cors.bridged.cc/ //Previously: https://cors.bridged.cc/
imageurl = 'https://api.codetabs.com/v1/proxy?quest=' + url; imageurl = 'https://api.codetabs.com/v1/proxy?quest=' + url;

2
local_art/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore