daasd commited on
Commit
4759dac
·
1 Parent(s): bb7ac47

Update PNG_info_web.js

Browse files
Files changed (1) hide show
  1. PNG_info_web.js +5 -2
PNG_info_web.js CHANGED
@@ -722,14 +722,16 @@ let imgStorage=(img)=>{
722
  png_info.addEventListener("change", async (e) => {
723
  // 获取用户选择的文件
724
  const png_info_img = await delay_png_change(png_info);
725
- imgStorage(png_info_img)
 
 
726
  let png_info_blob = await convertDomImageToBlob(png_info_img);
727
  this.png_info_blob = png_info_blob;
728
  let res = await readNovelAITag(png_info_blob);
729
  this.shadowRoot.querySelector(
730
  "#tab_pnginfo > div > div > div:nth-child(2) > div:nth-child(3)"
731
  ).innerText = res.length ? res[0].text : "这不是一张stablediffusion图片";
732
-
733
  //js对象形式转化
734
  const result = {};
735
  // const match = inputString.match(/(?<=prompt:)(.*)(?=Negative prompt:)/s)[0].trim();]
@@ -766,6 +768,7 @@ let imgStorage=(img)=>{
766
  localStorage.setItem("tempPngInfo", JSON.stringify(this.result));
767
  inpaintTabFormFill();
768
  };
 
769
  });
770
  }
771
  document.addEventListener("DOMContentLoaded", async () => {
 
722
  png_info.addEventListener("change", async (e) => {
723
  // 获取用户选择的文件
724
  const png_info_img = await delay_png_change(png_info);
725
+ try{imgStorage(png_info_img)}
726
+ catch(e){
727
+ if(e){console.log('图太大。将不会被保存到本地')}
728
  let png_info_blob = await convertDomImageToBlob(png_info_img);
729
  this.png_info_blob = png_info_blob;
730
  let res = await readNovelAITag(png_info_blob);
731
  this.shadowRoot.querySelector(
732
  "#tab_pnginfo > div > div > div:nth-child(2) > div:nth-child(3)"
733
  ).innerText = res.length ? res[0].text : "这不是一张stablediffusion图片";
734
+
735
  //js对象形式转化
736
  const result = {};
737
  // const match = inputString.match(/(?<=prompt:)(.*)(?=Negative prompt:)/s)[0].trim();]
 
768
  localStorage.setItem("tempPngInfo", JSON.stringify(this.result));
769
  inpaintTabFormFill();
770
  };
771
+ }
772
  });
773
  }
774
  document.addEventListener("DOMContentLoaded", async () => {