This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
data_url [2011/06/08 16:33] Joel Dare |
data_url [2020/06/01 22:53] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Data URL ====== | ||
+ | |||
+ | This is a PHP script that will load the specified HTML document and convert it to a data URL. It's Useful for generating off-line web apps, especially for the iPhone. It makes 3 passes which do the following. | ||
+ | |||
+ | - Convert JavaScript to data: URL's | ||
+ | - Convert Images to data: URL's | ||
+ | - Convert the whole document to a data: URL | ||
+ | |||
+ | It does not currently convert linked CSS but adding that should be trivial. | ||
+ | |||
+ | {{:data.zip|Download (data.zip)}} | ||
+ | |||
+ | ===== img2data ===== | ||
+ | |||
+ | This is a modified version of the code which converts only url's in <img> tags into data. This base_64 encodes the binary image data and embeds that data into the HTML file itself. Here's how you use it. | ||
+ | |||
+ | img2data.php index.html > combined.html | ||
+ | | ||
+ | That command reads //index.html//, parses all of the included images, and stores the result in //combined.html//. | ||
+ | |||
+ | {{:img2data.zip|Download (image2data.zip)}} | ||
+ | |||
+ | ===== License ===== | ||
+ | |||
+ | |||
+ | This source code is distributed under the [[MIT License]]. | ||