This page is part of the BugReports series. Please go there to submit a new bug or to see the list of all existing reports.


picture upload not working with db_flat_files

===
OOOOOPS..... PLEASE ....
===
I was not aware that the IP address is published..
As I am writing this from a rather paranoic friend's computer: 
PLEASE can you delete or change the address - she'll KILL me otherwise.
(Next time: from home or dial-up....)
THANK YOU !!
===

mario: I remove the IP address from the database, if that makes your friend feel better... :)

ewiki version R1.02a
operating system NT (2K,XP)
database backend db_flat_files
php version 4.3.x
bug category plugin
status frozen

anonymous: Showing only placeholder instead of uploaded picture.

Cause:

plugin:   flat_files.php,
class:    ewiki_database_files 
function: WRITE

saves Image content TWICE to the file "internal://md5...."

my personal solution:

added 4 lines, marked here with <!

          #-- write
          if (EWIKI_DB_FAST_FILES) {
             $val = serialize($hash);
             if (($f = gzopen($dbfile, "wb".*EWIKI_DBFILES_GZLEVEL))) {
                gzwrite($f, $val);
                gzclose($f);
             }
             return(1);
          }
          else {
             $headers = "";
 <!         $siisimage=( preg_match("/image/",$hash["meta"]))?"siimg":"siNOimg";
             foreach ($hash as $hn=>$hv) {
 <!             if($hn=="content"){
 <!                 if($siisimage=="siimg")continue;
 <!             }
                $headers .= $hn . ": " . str_replace("\n", *EWIKI_DBFILES_NLR, $hv) . "\015\012";
             }

mario: That was a general bug in the flat_files database (I only found this last week). It was always saving the "content" field twice (needlessly). Fixed now.

I'm just not sure, what your other changes are going to address. And I'm also not sure, why the additional content (though its bogus) broke the image displaying in the first place.

stefan:

1. Thanks for removing the IP ....! 2. Though I don't know much about the jpeg format, it seems obvious to me that appending image data again to a jpeg (that already contains its meta data and the correct set of image data) will corrupt the picture. And that's what it did. Anyway, I am going to download the new version.

By the way: !!Thank you for ewiki !!!

bottom corner