GIF Overlay

FREEMIUM
By Liaqat Ali | Updated a month ago | Video, Images
Popularity

0.1 / 10

Latency

1,018ms

Service Level

100%

Health Check

N/A

README

How you can send a POST request with PNG and GIF files using React and download the resulting GIF file in the browser:
import axios from โ€˜axiosโ€™;

const handleSubmit = async (event) => {
event.preventDefault();

const formData = new FormData();
formData.append('gif', gifFile);
formData.append('png', pngFile);

try {
    const response = await axios.post('http://localhost:5000/gif', formData, {
        headers: {
            'Content-Type': 'multipart/form-data'
        },
        responseType: 'blob'
    });

    const url = window.URL.createObjectURL(new Blob([response.data]));
    const link = document.createElement('a');
    link.href = url;
    link.setAttribute('download', 'final_image.gif');
    document.body.appendChild(link);
    link.click();
} catch (error) {
    console.error(error);
}

}

return (

     setGifFile(e.target.files[0])} />
     setPngFile(e.target.files[0])} />
    Download

);s

an example of how you can send a POST request with PNG and GIF files using PHP and download the resulting GIF file in the browser:
$file_gif,
โ€œpngโ€ => $file_png
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($status_code == 200) {
    header('Content-Type: image/gif');
    header('Content-Disposition: attachment; filename="final_image.gif"');
    echo $response;
} else {
    echo $response;
}

?>

Followers: 0
API Creator:
Rapid account: Liaqat Ali
Liaqat Ali
infotech30005
Log In to Rate API
Rating: 5 - Votes: 1