Fromate suportate:
Api-ul permite compresarea fsiserelor originale si conversia in format webp sau avif.
GIF, PNG, JPG, JPEG, JIFF
API URL:
Method:POST
https://resize-image.denda.ro/api/v1/convert/start-process/<<Api KEY>>
Parametri:
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" : dimensiunea <<valori numerice >> sau null,
"options" : "webp" sau "avif" sau null ,
"sufix" : true or false
}
Fragment de cod:
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);
});
Răspunsul cererilor:
Apare atunci când toate funcțiile sau executat fără problema.
{
"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"
}
Apare atunci când URL sitului este invalid sau nu conține fișierul respectiv.
{
"status":"Not Found",
"message":"url invalid"
}
Apare atunci când api key-ul specificat nu este indetificat in baza de date.
{
"status":"failed",
"message":"Invalid Api Key"
}
Valori permise: options:"webp" sau options:"avif"
{
"status":'error',
"code":'Invalid options value | 'webp' or 'avif' are allowed.'
}
Valori permise: sufix:true sau sufix:false
{
"status":'error',
"code":'Invalid sufix value | true or false are allowed.'
}
Poate fi cauzata de salvarea incorecta a imagini.
{
"status":'failed to extract data from image',
"code":'ERR_INVALID_PROTOCOL'
}