Code Monkey home page Code Monkey logo

imgapp's People

Contributors

kenz avatar tanaikech avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imgapp's Issues

Images on Team Drives

Seems to not work for images on a team drive.

If I move the image to my drive and run your resize, it works fine. But errors out on the file ID on a team drive.

Add option to send in blob instead of FileId?

I want to use your ImgApp in a script but I dont have the files in google drive yet. I will however be grabbing from Twitter profile images and wanting to resize them from 48x48 to 32x32. I can grab the blob from the URL they give me to the profile image, so it would be nice not to have to save a copy to Google Drive in the meantime as I process it and then commit the blob to a github repository within the same script.

I looked at the code and it appears the top of the coffee script is what ddrives the user accessible functionality. If we added the following I believe we can achieve this:

/**
 * <h3>usage</h3>
 * var res = ImgApp.doResizeOnBlob(blob, width);<br>
 *<br>
 * @param {string} blob The blob of the image to resize
 * @param {integer} width Resized width you want
 * @return {Object} JSON object {blob: [blob], originalwidth: ###, originalheight: ###, resizedwidth: ###, resizedheight: ###}
 */
function doResizeOnBlob(blob, width) {
  return new ImgApp().DoResizeOnBlob(blob, width)
}

Then add a DoResizeOnBlob method that will contain a call to GetResizedSize and a similar set of returns as DoResize would return.

I am not that familiar with Coffee scripts, so I figured I would put in a request instead of trying to develop something myself without much understanding of how it all works or how to properly test.

This functionality would be really really helpful and seems like an easy thing to implement. Alternatively, you could have the end of DoResize return what the internal function for this new functionality would return, so the code isnt being duplicated, just broken out so it had more options for users. But again, not entirely sure how it all works, so I shall let you figure out if you wish to attempt that path as well.

Issue with images over a certain filesize?

I started using ImgApp successfully, but then tried changing my sample image.
Initially I was using a 1200x1200 pixel simple png image that was only 16KB in size.
When I changed it to a file that was larger in terms of file size, I started to get an error:

Exception: Request failed for https://lh3.googleusercontent.com returned code 400. Truncated server response: <!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <titl... (use muteHttpExceptions option to examine full response)

I haven't found a way around that yet. It seems like the limit is something between 70 and 75 KB.

doRisize() stopped working.

I am working on a tool that works with HtmlSerivce in GAS to shrink images.

The doRisize(), which used to work, does not run and gives the following error.

stack:Error: '*****************' is not compatible file. Error message is {}
    at ImgApp.DoResize (code:308:15)
    at Object.doResize (code:35:23)

On the other hand, in the test environment (different script ID) with the exact same source,
doResize() runs and shrinks the image.

Note that getSize() is still available in the same environment.

Do you have any idea what the cause might be?

Unable to look up library

Screenshot 2023-06-26 at 3 30 49 PM

Hi, I'm getting this error when trying to run the script
"Unable to look up library. Check the ID and access permissions and try again."

I used the following ID to add the library: 1T03nYHRho6XMWYcaumClcWr6ble65mAT8OLJqRFJ5lukPVogAN2NDl-y

"Is not compatible file"

Hello.
I have some TIFF files over 200 mb.
I wanted to get data about the width and height of an images. But Google does not process files over 200 MB. The get.Width() and get.Height() request returns 0. For TIFF files less than 200 MB, I can get their sizes.

Fragment of code:

let fileId = file.getId();
let dims = Drive.Files.get(fileId, {supportsAllDrives: true}).imageMediaMetadata;
let width = dims.width;
let height = dims.height;`

I tried using your doResize () function but got this answer: "Is not compatible file"

Is it possible to solve this problem using your application? Or maybe there are some other ideas?

get screenshot page 1

can you help me to make function to get screenshot every page 1 in a document in a folder?

Error: '***************' is not compatible file. Error message is {}

こんちにわ。ImgAppを使わせていただき、GASで開発を行っています。
doResizeを行った時に、以下のようなエラーが出ています。

スクリプト内容

function test_resize(){
  var fileId ='***************';
  let res = ImgApp.doResize(fileId, 500);
}

エラーメッセージ

Error: '***************' is not compatible file. Error message is {}
ImgApp.DoResize @ コード.gs:303
doResize @ コード.gs:35

getSizeは問題なく実行でき、対象のファイル形式はJPG形式となっております。
{identification=JPG, filesize=4040889.0, height=3024.0, width=4032.0}

appscript.jsonの内容を

{
  "timeZone": "Asia/Tokyo",
  "exceptionLogging": "STACKDRIVER",
  "runtimeVersion": "V8",
  "dependencies": {
    "libraries": [
      {
        "userSymbol": "ImgApp",
        "libraryId": "1T03nYHRho6XMWYcaumClcWr6ble65mAT8OLJqRFJ5lukPVogAN2NDl-y",
        "version": "10"
      }
    ]
  },
  "webapp": {
    "executeAs": "USER_DEPLOYING",
    "access": "ANYONE_ANONYMOUS"
  },
  "oauthScopes": [
    "https://www.googleapis.com/auth/spreadsheets",
    "https://www.googleapis.com/auth/drive.readonly",
    "https://www.googleapis.com/auth/drive",
    "https://www.googleapis.com/auth/script.container.ui"
  ]
}

こちらに書き換えると実行ができます。

{
  "timeZone": "Asia/Tokyo",
  "exceptionLogging": "STACKDRIVER",
  "runtimeVersion": "V8",
  "dependencies": {
    "libraries": [
      {
        "userSymbol": "ImgApp",
        "libraryId": "1T03nYHRho6XMWYcaumClcWr6ble65mAT8OLJqRFJ5lukPVogAN2NDl-y",
        "version": "10"
      }
    ]
  }
}

ただし、他の新規GASスクリプトファイルを作成し、oauthScopesがない状態でもエラーがでます。
複合的な条件だとは思いますが、oauthScopesは必要でして、原因をご調査いただけないでしょうか。

何卒、よろしくお願いいたします。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.