Next.js Discord

Discord Forum

Can webp images be used in <head>?

Unanswered
Chinese softshell turtle posted this in #help-forum
Open in Discord
Chinese softshell turtleOP
Around a year ago i read somewhere that using webp in meta tags wont work so what i did is when someone uploads an image i was creting jpg and webp versions of that image so i can use the jpg in the meta tags.

Question is can i fully go webp?

19 Replies

I guess all major platforms support it, but that doesn't mean that all platforms support it
ya, go full jpg, 250 kb is basically really less
@Anay-208 ya, go full jpg, 250 kb is basically really less
Chinese softshell turtleOP
i was observing if i should go full webp just because its better but the downside is that it might not work everywhere.

for extra context i have my images stored in cloudflare r2 and i have them cached. And literally the worst case will be 250kb in my head. Also i tested a huge image (6mb png) it was served in 80ms
so with that being said webp or jpeg with size of 200ish kb would make no difference
I personally prefer to use jpg, and webp for images which maybe require a transparent background(when I make apps using expressjs, nextjs handles image optimization on its own)
@Anay-208 I personally prefer to use jpg, and webp for images which maybe require a transparent background(when I make apps using expressjs, nextjs handles image optimization on its own)
Chinese softshell turtleOP
<Image /> component stores cache locally and its like

client -> next.js cache -> cloudflare cache if not next cache -> r2 storage if no cache

while if i dont use <Image /> or if i use unoptimized=true, then its like
client -> cloudflare cache -> r2 storage if no cache
Chinese softshell turtleOP
i really dont know if i should use Image component, the host is not that strong and i dont know how its going to handle hundreds of people

the pages will be with ISR
if you still want to your cloudflare, use its image transformation to optimize
research about it
you just have to create a custom loader
to support the cf one
(For any more qs, I'll respond to you tmr)
Chinese softshell turtleOP
i will be uploading optimized images. The images wont be big in dimensions and their quality will be lowered to 80% before uploading to the storage.

i will be having main image, medium and small for the same image
i cant afford to pay to cloudflare for transformations
alr it should work just fine then