Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should add the ability to access photos via file #2

Open
eienmojiki206 opened this issue Jan 24, 2024 · 4 comments
Open

Should add the ability to access photos via file #2

eienmojiki206 opened this issue Jan 24, 2024 · 4 comments

Comments

@eienmojiki206
Copy link

Add the ability to access photos through files for ease of use in many situations

@SOME-1HING
Copy link
Owner

@eienmojiki206 How about I add two parameters picUrl which is set to true, provides an array of image URL based on limit parameter? How does this sound?

@eienmojiki206
Copy link
Author

@eienmojiki206 How about I add two parameters picUrl which is set to true, provides an array of image URL based on limit parameter? How does this sound?

@SOME-1HING Sounds good. But I strongly recommend editing the API so it can be more consistent. I'm assuming that the user wants to download an image from the Internet and then pass it into the API (Since the API doesn't always accept all image link formats), they might want to use the following code:

const fs = require("fs");
const url = "https://google-reverse-image-api.vercel.app/reverse";

const data = new FormData()
const image = fs.createReadStream('/path/to/image')
data.append('image', image); // instead of "imageUrl"

fetch(url, {
  method: "POST",
  body: data,
})
  .then((response) => {
    if (response.ok) {
      return response.json();
    } else {
      throw new Error("Could not perform reverse image search.");
    }
  })
  .then((data) => console.log(data))
  .catch((error) => console.error(error));

@AryanPadmanabhan
Copy link

Has this been updated in the API? The ability to use a file of an image rather than a link.

If so, how can I use it?

@SOME-1HING
Copy link
Owner

@AryanPadmanabhan I've been pretty busy lately, but I've still been trying to make some progress. However, I'm running into some problems when using the image buffer.

If anyone has any experience with this and can help me out, I'd really appreciate it! Feel free to submit a pull request (PR) if you have a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants