• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.

Image base64 and API call

buzzdee

Chevereto Member
Hi,
Could you please help me to understand this part in the API-documentation:
Either the URL or a base64 encoded image string, the system automatically detects what are you uploading.
Image base64 string must be sent only by POST method due to $_GET length limitation.

In my Firefox Add-On images that are not base64 encoded are uploaded like this, and works fine:

But when I try to upload an base64 image, the API response is
image base64 string must be sent using POST method

Now I could write a query to check wether the image is base64 encoded, but then I need to decode the image, because sending POST requests via URL isn't possible.

Does anyone of you have an idea how to solve this?
 
A base64 image string is a base64 representation of the image. Is like the image code converted to base64. This base64 string is very long and due to this using the GET method results in that this image can't be sent using GET request, you need to send this using the POST request method.
 
A base64 image string is a base64 representation of the image. Is like the image code converted to base64.

OK, so then I might have the problem, that even if I decode the image, I get the image - and not the URL of the image, right?
Well, then I have to check if the user right-clicks on an image which is base64, and give the alert("cant be uploaded").
Damn! I thought that there could be a way to decode image (and therefore get the URL), and upload it via GET, like mentioned above...
Thanks Rodolfo!
 
Your program should convert the image on the fly and it must be POST because the GET method has a limitation on the lenght of the query string, this means that it chunks the string and the image is invalid.
 
Just coming back to this subject... I'm experiencing the same as buzzdee.
I'm currently trying to modify the "Chrome extension" to enable a nice new feature. However this base64 is getting in the way, and I don't know how to solve it.
Now Rodolfo, you say - "Your program should convert the image on the fly" - this makes total sense, but do you have any idea how to do it? Because I haven't got a clue!!! It would be fair to say that I'm a complete newbie when it comes to javascript / php and similar scripts.

If I could get a "base64" image uploaded, It would be a huge step forward on my little project.
 
Actually is not longer necessary to convert the image to base64. Probably base64 image string is the best method to send large images trough PHP but you can also use the $_FILES request.

As you may notice this code on the API:
PHP:
        if(check_value($_FILES['upload']['tmp_name'])) {
            $to_upload = $_FILES['upload'];
        }
Is telling that any $_FILES['upload'] will be parsed as the $to_upload.

Notice that either the base64 and the $_FILES are used for local images, if you want to handle remote images you only need to use the URL.
 
Back
Top