Location: PHPKode > scripts > gif2function.php3 > gif2function-php3/example.php3
<?php


/*
May 10, 2000.

Written and tested on PHP 4.0 RC1 (mod_php)
Linux/Apache. Tried on PHP 3.0.14 Win2000/IIS
5.0 for a minute or two, it worked.

==============================================================
This script is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS  FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

Copyright (c)2000 Pierre Marceau. You may  freely  use
and  redistribute  under the  terms of the  GNU General Public
License.
--------------------------------------------------------------
      gif2function - http://www.skynet.ca/~pierre/
==============================================================
*/

  function php4gif() {
    header("Content-type: image/gif");
    header("Content-length: 4907");
    echo base64_decode(
    'R0lGODlhjwBBAPf/AP///wgICBAQEBgYGCE'.
    'hISkpKTExMUJCQkpKSlJSUlpaWmNjY2tra3'.
    'Nzc3t7e4SEhIyMjJSUlJycnKWlpa2trbW1t'.
    'b29vcbGxs7OztbW1t7e3ufn5+/v7/f396Wc'.
    'nFpSUufezv//99bWzr29raWllHt7aykpIXN'.
    'zWr29jJyca5SUY62tc8bGhKWla62tY8bGa6'.
    'WlUr29WtbWY8bGWrW1UsbGUt7eWikpEOfnW'.
    'mtrKa2tQkJCGJycOefnUtbWSu/vUhgYCGNj'.
    'IcbGQpSUMYSEKRAQANbeWqWtWoyUUpylY4S'.
    'MUq21jJyle2NrUlpjUmNrY+fv75ScnEJKSl'.
    'pja+fv9+/3/4SMlFprhFpjczlCUkJSc7W9z'.
    'pScrYyUpVJaa0pSYwgQIb3O94SUvUJSezlK'.
    'c0pjpd7n/73G3lpje3uMvcbO56WtxmNrhFJ'.
    'ac7XG/0pSa5yt52t7rTE5UikxSlprpUpajF'.
    'JjnCEpQr3G53uEpaW171pjhIyc1mt7tTlCY'.
    '2NzrVprrVJjpWN71jFChBghQiExa9be/87W'.
    '97W93q211qWtzpScvYyUtYSMrZylznN7nGt'.
    'zlFpjjJyt93OEzjE5WjlCaykxUlprtVJjrS'.
    'k5exghSjlSvc7W/6Wt1pScxnN7pVJahJSl/'.
    '0JKc2NzxikxWlprxlJjtSEpUjlKnDlKpUpj'.
    '1jFClEJazik5hEJa1ilCvRgpe73G962155y'.
    'l1nuEtVpjlFpjnIyc90pShEJKe2Nzzmt73j'.
    'E5a1JjzkJSrSEpWjlKrUpj7zFCpTFCrTlS5'.
    '7W995Sc1oyUznN7tWtzrWNrpVJalEJKhGt7'.
    '71pr3kpaxkJSxjlKzpSc3mNrrWtzvXuE3mN'.
    'rtWNrvUpSlDE5eyEpczlK1hghexAYa4yU74'.
    'SM53N71oSM92NrxikxjCEpjOfn7/f3/87O1'.
    'rW1vZycpWtrc3t7hNbW597e71paY3NzhN7e'.
    '/2Njc1paa0pKWpSUtb2973NzlMbG/ykpOZy'.
    'c55yc75SU9yEhORgYOQgIMQAAACwAAAAAjw'.
    'BBAAAI/wABCBxIsKDBgwgTKlzIsKFDh+22M'.
    'IoDyVYtSI3WcHjIsaNDcxzYnUu0xtEiRo0a'.
    '5cnzqaXLlSkZLVq0ZssZDVQ8ejS3JY8tOra'.
    'W1cFVZ5kdoZDW5NTJlGGHcufOKFpEcZlVoZ'.
    'GEXhVap6vXr0S/1qn1iV7NDOXMNTWoRsw0O'.
    '3XGeGlyou4TL7is1mGzZa1fgeXUKKKlzJYd'.
    'O7WWJb4aSWydrI4dg8JFmWhlyl0j5Vlzbin'.
    'TRHFsjZmHZMaP06h/1CihpY4tZlbK/eVojl'.
    '0iqoVt6ba41ahRO7rpABUuXBkd48aB/jSs+'.
    '6rXy5WZ1cG4RgPHDp3+1PGDBEfq76dtqP8Y'.
    'U6sOmgxqZycMrChOMmV/cjc3Gpy4/fv48+c'.
    '3bljvUOi4MAPJIufIppA5jiTDTAI1gOfgaT'.
    'G0IRQbInSgXkFUnCEGMnF0qExutQD3k34kl'.
    'miifkf9NwYzuIyRCyh5bOFZQYpo54R3D+Kg'.
    'gw/fzdCGHWO8g4GF6nVwhiMbIoPMe7uNeGK'.
    'JgAgXJR1TVinlk8QdFQllK7oI4xZECsSOMs'.
    'vMY8SDPwwRwD8B8Jiaj8uIYsWQf7WDyDFiH'.
    'JMGMoUdpt+UWAYqKIrLcJmLl/RYB4AndFQC'.
    'A5o1rPnPPzqA54JQb0ywwVrtdMLHMXykkQx'.
    'zg5I4jRpUlJPqqmpMU2qgQbX/OMaszOQBGi'.
    '5NoIkDEJNOWil4bNgiyjsXhMnRIbLAAccxS'.
    'xr2aoliiFDAtNOaYIAGyDybH6D32TLUoWNQ'.
    'RgkNaO7Q66TkgpeEUF5MoOhHhhQjrzHZOqs'.
    'tiYlIcO6kBZTzx72DCjWGKJRIgSN4OUx6Q8'.
    'KUOihDUW9AUKxDVHASRhiypGEvwCSqscC+/'.
    'yzADseDkknJHSc8OMSkRQhBhK8O4nCFLW88'.
    'UMGmC5ljiCEWH+PnfVZSeaXQRAdt5TQcGAB'.
    'yBImQLCggy8hxBxIORjopDz+83LCDDtghyg'.
    'PuLkSFGVUYMssfdjhtIjIbCADyBWKoHWjUc'.
    '1D9nRBFTBqEDjoE/zEpEW5+17UoDkiQQULm'.
    'UGGOOYeksYyTxHGrtiPogDwAtnJjuQwlcyg'.
    'B3g0g70sEeO94/UAEhx9kThUAmIPIxpnrt8'.
    'UDIB/QTuRDG5377kXzDogdlFiS8nfmht4r1'.
    'qnhUEstX0eAwUFVqFWFJ3YEYmIyiZyR/fba'.
    'd899IoockwyJ7SQAsgNUJGLT9lskguT4+CH'.
    'z/fr0a7++ImLAT1wllmRhA3g+4JsA/fYPwI'.
    'HnBXD5QuFSRxDWAcAMaUjbiRJhAQYwoAEXz'.
    'CAGN3jB01EgA7bRn3CSwYEC1K4BKNxgAxwA'.
    'AQlUAISOcBVxzuABC6bwhjhswAMkYAENsEM'.
    'R8MOFHP8okQQ0oUZrv/oOE0QjD7C9SyDRA0'.
    'A7lCHBE7FDAcbL4qQQYAEOHONKYjiHpLQIs'.
    'gAoQATsyJZw2qE0MpYxARdoBy2g5gdKKOBg'.
    'D0IieHDwCDv4QYcU2MhAqBA9NdChitcrRxv'.
    'dGDopZIBRwlGEBxiZxQf4iw5sGwAly+gADs'.
    'QtF5SghAqM+AMeTCpwqFnCH3LxhQfMKUzmI'.
    'Jsh4oBIE4khA2Pc5LkM4EXhnIEBugxdBRxB'.
    'BzFgIJggUwAVxGCHSlDCDzEgpRAa9B0W9KE'.
    'O89Bh2AZyiJ3RApG6I5ojKBC6NQXAnGT8QD'.
    'nGx45FInNSHzgDHRIRAeOdk01uZMAU61D/C'.
    'V684QWkBA8LIuiHeKxDYmFqRzHCwMyhnegM'.
    'DgCZATJA0XNkAAMXmMACcnkudCiCDhlw274'.
    'WcIEKmNSkFHiAJiU6Mo+BLAEayMA5LHoOC0'.
    'ggARydVAAwwChcVMIPokhBQFGDAmQ0s4kPo'.
    'ADOBNIJPRijlieaRjkOALIFnOEPceAQMtLg'.
    'iZsgIHQLUAMyKhA6dByDFmlAqxjEoIgLiHS'.
    'X7JCqOycVAURgVauN8IQaMmBCkD1gC1Gqgy'.
    'gqQQZ1ANSILOiCNbDhB3c44AEeyECY1MAHY'.
    'xRmUJn0KyTx4wkNvLVX13IE7fYlgAwk5z5n'.
    'mOs/DqAGWnj2bWI4rTj1lcyR/wknLqIQRS4'.
    'cwIQXyAAHwJXBC5jwCKAwYx5TeADYzmEsT+'.
    'wJqicSwwVCRwFa/KkdX90XAdhxho/tywC2x'.
    'Y8aVJuALXiCrPsaAAfUiJ8/iBFkUgjvIVsE'.
    'LqJkZTFGwYUfFPgACHzQWOyIQx9kGyh6lvE'.
    'c/9LPFS23gXZQdV8NkCd+AHGOlZ7LAY5IxG'.
    'jPhYDbkegcn92ifIUDl8s8RxR+QG4DDurCp'.
    'Q4kEbZQRi1e9UuJGpJ8D95lqggAMgl8NH7o'.
    '3dcEPMEO8+3LARLOzzQukNMEjPg4JPbPMsb'.
    'Auce28IWCLAgjLALdE2G3qk3TT2b3hQAq4B'.
    'JkGIgbZyFwYDFsgP/H+6IAMfVDC3KCjAFJJ'.
    'lFyxmCJOagDAhXQgLEK8gmrQA5LfyhHX88V'.
    'gc1ydrp+7YCdz0WAdeYnEd49VwE04Ilj7is'.
    'AGrCufjoR0R6H+UlCnMMUIGCBQRckMa4plW'.
    'tD/A+4kQ+Yb6NCqc+VAA/jhx057pWTO0FbS'.
    'l8yP39wMMgEoAE1R7UOnJMHq7N8kPLEelCO'.
    'CHKvLtcH/SgCA3kjc6qCPam/So4OUoXzuSC'.
    'gPlxz+MnEoSBYff2kqN3BCzajtkHKg4u0hV'.
    'N3s4NvOfRzDA2o9h8WuImFe4WOOd8nDWfel'.
    'wX0qtoFnPo+idDAonu1U4efCBC4mMMdmlgB'.
    'fRckD5T/mfGgync+eQJCGdNIBi26moHs7qv'.
    'XnoD0uZgt6vtke9kaSEOFQQYBYsI85lyt6c'.
    'Z79YAxCWoMIo9HUk1OEHpQZhmDSkY51N2rC'.
    'GjgHBc4BwYwgI6b5vQfBciA/Nj83XLIELUN'.
    'qJ0cJ32uCWQg7GIvaQQO/g93dIC9WKrEHe7'.
    'QgGkr5BzMGEMdBmXMcqLz7JTWwEcXvC8GwH'.
    'sayobwGTyx4XOdU1KQ79UBOuBszckBH1k46'.
    'MQS0oEtjeHQJlJEsd/5jwRs4KOYX/o/JNCJ'.
    '/MRhAwuf1AQcoQgj0/4fCiiHx580jVzMgR/'.
    'zOJ0I0pOQRbho8YFSg7uRGYAG9JIOrs1p/5'.
    'rzcwydc1wEYjgD14NJgAgs81WU4McdpK5Uh'.
    'nAAFLnIBez1I9d3DqABGyBWxOEIE8BggBdv'.
    'bHcuJiBHGBB6WtR+RiJCWAJyd8APWdBfXdQ'.
    'Qa5BbzIAlsyZRCIAAByCCIZgADLBDcdQW97'.
    'EFE3AAI/iC+qQfZ7B3JOiCTZcGlVM7JPgFI'.
    '4gACsAAEDABGNAOrSUcl2AigAIIUCMH/OBn'.
    '65AOT7QQkJBbuPAk58Vg7cAOWriF3LUFjkA'.
    'YEyYGXLiF7fBF+UFkWTiGYuAI9bQvBUAFWV'.
    'gP9bCFaqA9nsAnUnIJ5wY0kRMIgscPrWQFF'.
    'zAjC5EBWkAGooB1UBJw33U71v9DHI+4hyTy'.
    'iCZCifZxBnG3Lx8QXuJgCiViCuLwcfYxCL9'.
    'ggQ5gD1wQhQyxgZWQiCZSZC91Y7ETKIAwVS'.
    'BjBYmACVJSDbqgh76ohEqoC54oinSQC6RQC'.
    'JbQAPZACxegE1xAWK6oH1qnew3wY7OIJcig'.
    'AcH3D2tgDNcgDnpYCsWgD7tQjrvgDLpQCuB'.
    'QCpiwh9wSJblgCYWACsrwCThIiA/RBZWwj9'.
    'iHH8aUUxNQetdoIp5gAUBnXddQDYLgC3UAA'.
    'fbABvbwDmyADbUwCtfQC6VwCRoJjMAoNJiQ'.
    'DXNgCYOACriADcZwCBayOg70EFbwU35QhZK'.
    'jCAX4NhI4kPiSgKD/RQWuEgjXoA9ZgAEbwA'.
    'FCuQEbAAIHcAm7IAgYeQ0aaQrXYAoaeQlvk'.
    'Q2DoA2DcA1eAAII8A2SwAnwYAbwQH0f8Yw/'.
    'FY0ztH2TQgDnYJNYQnnnwgCyCAilIAcdgAE'.
    'rxAAjAAAPkAmlUAqqwArQ8AwY2Quq8JfPcA'.
    '2BkA3ZMAy+YAqb8AYhMA/f4AZuYAhkI5YO0'.
    'QHooAV+4AeVUIXEUQ4LQADUUgAE0ACIwJZR'.
    'VQ4JQJrUQgAUcGqX8A2ikAAG8AhWUAAboAG'.
    'UUAq6oAqD4AVWsA5+MA7BQwnr8AB+UAip4A'.
    'vGmZwQEJm34Ab3AA9RxBQawAbPBFRYBwgyQ'.
    'gXguSrl/yCQqpkfZxCeqwKHogYI11AM32AK'.
    'yOAGWVABAJAApiAIzsALDQAAIQAAHWACEyA'.
    'C1tGfJaANw5AAG0EkCDCd92AIVXCdOrEBXU'.
    'Awz5QLilie12gKulAN1XALaFACeikPkrALq'.
    'PABABB3A7AAmpAFAIAB/NAPEwAAB4APIXAB'.
    '+NAPDgAA8+ANlGmdK8kUdckGzkQJn3mhE+Y'.
    '7SNo7SvpvDvVxuqAPx7AAAFABc6AP4eALCL'.
    'AB5iABE5AA3UAMd8ABEKAN0TAHJ6oAHcAPr'.
    '7ANkDkPDOqgi+MXHbABE9AGdfRMotCPGEoy'.
    'gCAO1aAP36AJF8ABB5AIs/AOcyClHSACG//'.
    'wBOQQDJrAAREAC8FwByHwAAvAAf1ADMSgBZ'.
    'GpD9RpnXH6Fx2gAVzgBaEUSp/pb0Szp4PSp'.
    '/nwDbeQDTm6AAZgBVJQAQ4ABiCKUwOAAOMQ'.
    'phHADWAaAhBQAAAQAfKoDvWpB5Y5qhfCARn'.
    'QBViQqngaa5LoqlAyCtWQDCbqnxwQlMm6DL'.
    '9AAgDAAR0QAgcABpI6CJUaAlHgDw/gn5syA'.
    'pZwDz96IQMhrRTABnU0RBV6bdmqrfihC5Vw'.
    'ACqUQgaADahQCI7lAPOADaTQBAaADKFQCQp'.
    'wAKOACdmEqXXgDfeAmfq6rxpQAQ/wBpQgB5'.
    'YAsKKQFz8xsK7KnrqwjtewBuj/sAY4uwiBc'.
    'JXWYAe+gA22gAzHIA3GIAuc4AaSIA2yEAZu'.
    '4A2TcAyywDP3YAYiO7ICMacYkA7vgKoqu7J'.
    'E2rKPIyWuEiVMuqRJqjuAMA2XwJSY0BXeYA'.
    'j6kA9ymw/Y8AbxEAd7IgY1oQYNagZmcLRea'.
    'Qj30KPRszpfabWsJ60X0AXq4AVZIAddy7K5'.
    'QBTAwTva8o7EERTYwAygJAdzkA1pwAy8kA3'.
    'SUQv20F8S4AjSgAeEVAV+Gz1gaZ1UAA87oz'.
    'gDEUv5irgF0QGKSwFWEA9fALkhGZIA65ktW'.
    'xRhy4cvFyVjqwznNh91kAsolrJ9Nnh3cAq1'.
    'QAnzgAU6BAERMAEU/4ABPjS1DQGtBLE6ups'.
    'z4YoBFjAB66AOWOAHKjsH9BuSKztEnbmPua'.
    'VbAFIZ0ptb+3innity1mu9czAPX8AGj6Bc3'.
    '0sBF5ABGxAmhcsQVXu76dsQT6EB7EsBUbAO'.
    'aCAPXzAPwlu/JFzCJixy9FvAKjwHWZAFCDw'.
    'F3RsBXFoBD6wB6HrBOJyZ4XpRFkABEyABEP'.
    'C+WOAFXxDC89DCjzvAJOy5cpAF2ovAX+AF8'.
    'qAOK9RfMuwBFFABFiC+QelqOfzFDRECqRJT'.
    'GGUBFeDD6SABURABbAwBbvzGcOzGbCzDXEo'.
    'BFGABWyygNtwBXgzGfqwTfMy7RKkBMXVRY3'.
    'cBiJzIiBA8dhhAUYRMlOjKx3+sEwEBADs=');
  }


  function techgif() {
    header("Content-type: image/gif");
    header("Content-length: 862");
    echo base64_decode(
    'R0lGODlhFAAUAPcAAP//////zP//mf//Zv/'.
    '/M///AP/M///MzP/Mmf/MZv/MM//MAP+Z//'.
    '+ZzP+Zmf+ZZv+ZM/+ZAP9m//9mzP9mmf9mZ'.
    'v9mM/9mAP8z//8zzP8zmf8zZv8zM/8zAP8A'.
    '//8AzP8Amf8AZv8AM/8AAMz//8z/zMz/mcz'.
    '/Zsz/M8z/AMzM/8zMzMzMmczMZszMM8zMAM'.
    'yZ/8yZzMyZmcyZZsyZM8yZAMxm/8xmzMxmm'.
    'cxmZsxmM8xmAMwz/8wzzMwzmcwzZswzM8wz'.
    'AMwA/8wAzMwAmcwAZswAM8wAAJn//5n/zJn'.
    '/mZn/Zpn/M5n/AJnM/5nMzJnMmZnMZpnMM5'.
    'nMAJmZ/5mZzJmZmZmZZpmZM5mZAJlm/5lmz'.
    'JlmmZlmZplmM5lmAJkz/5kzzJkzmZkzZpkz'.
    'M5kzAJkA/5kAzJkAmZkAZpkAM5kAAGb//2b'.
    '/zGb/mWb/Zmb/M2b/AGbM/2bMzGbMmWbMZm'.
    'bMM2bMAGaZ/2aZzGaZmWaZZmaZM2aZAGZm/'.
    '2ZmzGZmmWZmZmZmM2ZmAGYz/2YzzGYzmWYz'.
    'ZmYzM2YzAGYA/2YAzGYAmWYAZmYAM2YAADP'.
    '//zP/zDP/mTP/ZjP/MzP/ADPM/zPMzDPMmT'.
    'PMZjPMMzPMADOZ/zOZzDOZmTOZZjOZMzOZA'.
    'DNm/zNmzDNmmTNmZjNmMzNmADMz/zMzzDMz'.
    'mTMzZjMzMzMzADMA/zMAzDMAmTMAZjMAMzM'.
    'AAAD//wD/zAD/mQD/ZgD/MwD/AADM/wDMzA'.
    'DMmQDMZgDMMwDMAACZ/wCZzACZmQCZZgCZM'.
    'wCZAABm/wBmzABmmQBmZgBmMwBmAAAz/wAz'.
    'zAAzmQAzZgAzMwAzAAAA/wAAzAAAmQAAZgA'.
    'AMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'.
    'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'.
    'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'.
    'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'.
    'AAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAFA'.
    'AUAEAIQwBJCBxIsKBBAAgTKlyYUCDDhwsdQ'.
    'pwoceLDihYjksh4cSNHjR9BhmzocSQAjCFR'.
    'flTJkWVGlxZhUiw5UiZEgzhzBgQAOw==');
  }

  switch ($action) {
    case "techgif" : techgif(); return;
    case "php4gif" : php4gif(); return; 
  }

?>
<html>
<head>
  <title>
    gif2function example
  </title>
</head>
<body background="<?php echo "$PHP_SELF"; ?>?action=techgif">
  <div align="center">
    <image src="<?php echo $PHP_SELF; ?>?action=php4gif"><br>
    <image src="<?php echo $PHP_SELF; ?>?action=php4gif">
    <image src="<?php echo $PHP_SELF; ?>?action=php4gif"><br>
    <image src="<?php echo $PHP_SELF; ?>?action=php4gif"><br>
  </div>
</body>
</html>
Return current item: gif2function.php3