note 73283 added to function.pack

From: Date: Fri, 16 Feb 2007 00:21:55 +0000
Subject: note 73283 added to function.pack
Groups: php.notes 
Request: Send a blank email to php-notes+get-123471@lists.php.net to get a copy of this message
This is how you can produce a code that is in fact a picture. (This code is a complete tool, copy it to a file, call it 'somehow.php' and produce your pictures as hexcode). <!--// ***Begin of File*** //--> <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>" enctype="multipart/form-data"> <input type="file" name="thefile"><input type="submit"> </form> <?php $rh = fopen ($_FILES['thefile']['tmp_name'], "r"); $pb = fread($rh, 8192); fclose($rh); $pc = bin2hex($pb); $pd = wordwrap($pc, 76, "\".<br /> \n \"", 1); echo "<TT>\$hexpic=\""."$pd"."\"\n</TT>;"; ?> <!--// ***End of File*** //--> Copy the result in your site code somewhere. For to show the code as a picture you can use something like what dirk (at) camindo de wrote ... <?php $hexpic="....................... ....................."; $data = pack("H" . strlen($hexpic), $hexpic); header("Content-Type: image/png"); // maybe your is jpeg / gif / png header("Last-Modified: " . date("r", filectime($_SERVER['SCRIPT_FILENAME']))); header("Content-Length: " . strlen($data)); echo $data; ?> have fun! ---- Server IP: 217.160.72.57 Probable Submitter: 217.91.19.25 ---- Manual Page -- http://www.php.net/manual/en/function.pack.php Edit -- https://master.php.net/note/edit/73283 Del: integrated -- https://master.php.net/note/delete/73283/integrated Del: useless -- https://master.php.net/note/delete/73283/useless Del: bad code -- https://master.php.net/note/delete/73283/bad+code Del: spam -- https://master.php.net/note/delete/73283/spam Del: non-english -- https://master.php.net/note/delete/73283/non-english Del: in docs -- https://master.php.net/note/delete/73283/in+docs Del: other reasons-- https://master.php.net/note/delete/73283 Reject -- https://master.php.net/note/reject/73283 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#123471) next »