Denda Vivas

Convert - Resize Images

Supported formats:

The API allows compressing the original files and converting them to webp or avif format

GIF, PNG, JPG, JPEG, JIFF

API URL:

                        

Method:POST

https://resize-image.denda.ro/api/v1/convert/start-process/<<Api KEY>>

Parameters:

  • image_urlpdf file source <<https://exemple.com/file.png/jpg/...>>.
    *only https otherwise the error <<"code": "ERR_INVALID_PROTOCOL">> will appear
  • resize → specific image size. Initial value <<null>>,will take over the original dimensions of the images.
    *only numerical values, only the width of the images is specified, the height will be set according to the width so as not to affect the quality of the images.
  • options → specify the conversion format:webp,avif or null
    (conversion is disabled, only image compression will remain active).
  • sufix → adds an identifier to the images resulting from the conversion: false or true.
                            

sufix:true "convert" : "https://resize-image.denda.ro//user_dir_<<API KEY>>/finall_image/<<name>_avi.avif" "convert" : "https://resize-image.denda.ro//user_dir_<<API KEY>>/finall_image<<name>_web.webp"
sufix:false "convert" : "https://resize-image.denda.ro//user_dir_<<API KEY>>/finall_image/<<name>.avif" "convert" : "https://resize-image.denda.ro//user_dir_<<API KEY>>/finall_image<<name>.webp"

                        

'Content-Type': 'application/json' { "image_url" : "https://exemple.com/file.png/jpg/...", "resize" : dimensions <<numerical values>> or null, "options" : "webp" or "avif" or null , "sufix" : true or false }

Code snippet:

                            let  header = new Headers();
                            header.append("Content-Type", "application/json");
                            
let data = JSON.stringify({ "image_url": "https://exemple.com/file.png/jpg....", "resize": 800, "options": "webp", "sufix": true });
let options = { method: 'POST', headers: header, body: data, redirect: 'follow' };
fetch("https://resize-image.denda.ro/api/v1/convert/start-process/<<APY KEY>>", options) .then(response => response.json()) .then(result => console.log(result)) .catch(error => console.log('error', error));
                            const axios = require('axios');
                            
let data = JSON.stringify({ "image_url": "https://exemple.com/file.png/jpg...", "resize": 800, "options": "webp", "sufix": true });
let config = { method: 'post', url:"https://resize-image.denda.ro/api/v1/convert/start-process/<<APY KEY>>", headers: { 'Content-Type': 'application/json' }, data : data };
axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); })
.catch(function (error) { console.log(error); });
                            <?php
                            
$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => 'https://resize-image.denda.ro/api/v1/convert/start-process/<<APY KEY>>', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS =>'{ "image_url":"https://exemple.com/file.png/jpg....", "resize":800, "options": "webp", "sufix": true }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ), ));
$response = curl_exec($curl); if (curl_errno($curl)) { print "Error: " . curl_error($curl); } echo '<pre>'; print_r($response); echo '<pre>'; curl_close($curl);
                                let settings = {
                                "url": "https://resize-image.denda.ro/api/v1/convert/start-process/<<APY KEY>>",
                                "method": "POST",
                                "timeout": 0,
                                "headers": {
                                "Content-Type": "application/json"
                                },
                                
                                
"data": JSON.stringify({ "image_url": "https://exemple.com/file.png/jpg.....", "resize": 800, "options": "webp", "sufix": true }), }
$.ajax(settings).done(function (response) { console.log(response); });

Response:

Appears when all functions are executed without problem.

                        {
                            "status":"success",
                            "compress":"https://resize-image.denda.ro/user_dir_<<APY KEY>>/compress_image/<<name>>.jpg/png/jpeg....",
                            "convert":"https://resize-image.denda.ro/user_dir_<<APY KEY>>/finall_image/<<name>>.webp"
                        }
                      

Occurs when the site's URL is invalid or does not contain that file.

                            {
                                "status":"Not Found",
                                "message":"url invalid"
                            }
                      

Appears when the specified api key is not identified in the database.

                            {
                                "status":"failed",
                                "message":"Invalid Api Key"
                            }
                      

Allowed values: options:"webp" or options:"avif"

                        {
                            "status":'error',
                            "code":'Invalid options value | 'webp' or 'avif' are allowed.'
                        }
                      

Allowed values: sufix:true or sufix:false

                        {
                            "status":'error',
                            "code":'Invalid sufix value | true or false are allowed.'
                        }
                      

It can be caused by incorrect image saving.

                        {
                            "status":'failed to extract data from image',
                            "code":'ERR_INVALID_PROTOCOL'
                        }