WebP & SVG


mas.satriyo

Hosting Guru
Jadi bagusan mana pak pakai format WebP atau SVG ya?
kalo kami, tergantung jenis gambar yang mau ditampilkan
untuk gambar2 berbasis bitmap/raster, menggunakan format webp
sedangkan gambar2 yg berbasis vektor, menggunakan format svg

pemilihan format gambar sebisa dan semaksimal mungkin dilakukan saat proses produksi gambar tersebut
bukan melalui proses konversi di level aplikasi (misal dengan modul pagespeed di apache/nginx)
cmiiw
 

hendra0404

Poster 2.0
Hallo :103:,
Tuan-Tuan di DWH ada yang menggunakan Scrip PHP agar file png / jpg convert ke webp?
pengen buat system
e.g : domainku.com/images.php?urlimg=https://awsimages.detik.net.id/comm...6/6414c1ae-fcd1-49a6-8316-4a71c29f93ff_43.jpg


nah saat di accses agar respound headernya menjadi webp gmna ya...?

kira-kira ada saran atau ide buat systemnya kak,

goalnya agar formatnya menjadi webp :77:

Mungkin bisa di coba simple php code nya:
PHP:
<?php
// Function to convert image to SVG header
function convertImageToSVGHeader($imageUrl) {
    // Get the image data
    $imageData = file_get_contents($imageUrl);
    
    // Create a base64-encoded SVG image string
    $svgImage = 'data:image/svg+xml;base64,' . base64_encode($imageData);
    
    // Set the SVG image as the content type header
    header('Content-Type: image/svg+xml');
    
    // Output the SVG image
    echo $svgImage;
}

// Check if the urlimg parameter is set in the URL
if (isset($_GET['urlimg'])) {
    // Get the image URL from the urlimg parameter
    $imageUrl = $_GET['urlimg'];
    
    // Call the conversion function
    convertImageToSVGHeader($imageUrl);
} else {
    echo "Image URL not provided.";
}
?>
 

hendra0404

Poster 2.0
Kalau mau ke webp bisa di ganti header nya:
PHP:
<?php
// Function to convert image to WebP format
function convertImageToWebP($imageUrl) {
    // Get the image data
    $imageData = file_get_contents($imageUrl);
    
    // Create a base64-encoded WebP image string
    $webpImage = 'data:image/webp;base64,' . base64_encode($imageData);
    
    // Set the WebP image as the content type header
    header('Content-Type: image/webp');
    
    // Output the WebP image
    echo $webpImage;
}

// Check if the urlimg parameter is set in the URL
if (isset($_GET['urlimg'])) {
    // Get the image URL from the urlimg parameter
    $imageUrl = $_GET['urlimg'];
    
    // Call the conversion function
    convertImageToWebP($imageUrl);
} else {
    echo "Image URL not provided.";
}
?>
 

mybloodiscoffee

Expert 1.0
Hallo :103:,
Tuan-Tuan di DWH ada yang menggunakan Scrip PHP agar file png / jpg convert ke webp?
pengen buat system
e.g : domainku.com/images.php?urlimg=https://awsimages.detik.net.id/comm...6/6414c1ae-fcd1-49a6-8316-4a71c29f93ff_43.jpg


nah saat di accses agar respound headernya menjadi webp gmna ya...?

kira-kira ada saran atau ide buat systemnya kak,

goalnya agar formatnya menjadi webp :77:

Coba mampir ke: Optimole, Cloudinary, Sirv, Quic Cloud.

Kalo web saya basisnya WP, saya pakai optimole + litespeed + quic cloud cdn dan aktifkan image optimization dan LQIP + pakai cloudflare. Hasilnya gambar web diproses lebih kecil otomatis ke webp plus speed web terbuka sempurna 2-5 detik an (saya pakai plugin banyak n berat² jg). Pernah pake cloudinary n sirv tp balik lagi ke optimole.

Kalo ga pikun sih itu Cloudinary n Sirv support manual alias non WP jg bisa
 

Top