[TOP TIP] Image to embed

It is common in web development to embed small images within CSS or HTML. Here is a quick PHP script to help you convert an image to the proper serialized embed data.

Save the following as img2embed and make it executable (chmod +x img2embed)

#!/usr/bin/env php

Execute the script and give it the filename of the image as a parameter:

$ img2embed linode_logo_white.png 

The script is pretty basic, it does not do any checking about the input file, so if you want you can add that functionality yourself.


0 Replies


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct