#20400 [NEW]: Doing: base64_encode on JPG & GIF images. Error: The function ends prematurely.

From: Date: Tue, 12 Nov 2002 20:25:34 +0000
Subject: #20400 [NEW]: Doing: base64_encode on JPG & GIF images. Error: The function ends prematurely.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-24742@lists.php.net to get a copy of this message
From: dromar84@msn.com Operating system: win32 PHP version: 4.2.1 PHP Bug Type: *Graphics related Bug description: Doing: base64_encode on JPG & GIF images. Error: The function ends prematurely. The following PHP script is stable on *NIX platforms but unstable on Win32 platorms. <?php $LineLength = 50; $uploadfile = 'PATH TO IMAGE'; $uploadfile_name = 'PATH TO IMAGE'; $fd = fopen ($uploadfile, "r"); $size = filesize ($uploadfile); $c = substr ("$uploadfile_name", strrpos ($uploadfile_name, ".") + 1 ); $cont = fread ($fd, $size); fclose ($fd); $encimg = base64_encode ($cont); $imgcode = chunk_split ("$encimg", $LineLength, "'.'"); print $imgcode; ?> -- Edit bug report at http://bugs.php.net/?id=20400&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=20400&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=20400&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=20400&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=20400&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=20400&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=20400&r=support Expected behavior: http://bugs.php.net/fix.php?id=20400&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=20400&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=20400&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=20400&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20400&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=20400&r=dst IIS Stability: http://bugs.php.net/fix.php?id=20400&r=isapi

« previous php.bugs (#24742) next »