<?php function image_encode($AFileName) { return 'data: ' . 'image/jpeg' . ';base64, ' . base64_encode(file_get_contents($AFileName)); } ?> <!DOCTYPE...> <html...> <head> <title>Ćwiczenie 26.8</title > <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> body { background: #fdf7d0 } img { border: 1px solid black; } ... </style> </head> <body> <div> <h1>Pieniądze</h1> <img src="<?php echo image_encode('money.jpg') ?>" alt="" /> </div> </body> </html>
Listing 26.6. Plik index.php z ćwiczenia 26.8
Rozdział 26. Element img