News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

The appearance of user id in that file

Started by mikcsuuu, September 26, 2021, 09:50:08 AM

Previous topic - Next topic

mikcsuuu

Hi,
there's this code which I have

function pushfile(&$file) {
    header_remove();
  if (isset($file["type"])) header('Content-Type: '.$file["type"]);
  if (isset($file["name"])) header('Content-Disposition: attachment; filename="'.$file["name"].'"');
  print $file["name"];
  header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  header("Pragma: ");
  echo $file["content"];
  exit;

$h=fopen($filename,"r");
        $content = fread($h, filesize($filename));
        fclose($h);
        $file["type"] = "application/";  //
        $file["name"] = $real_filename;
        $file["content"] = $content."*".$context['user']['id'];
        pushfile($file);


This ID number was well placed into the downloaded file, but it disappeared after  converting it (e.g. from pdf to epub). Is there a good solution for that?

Arantor

What exactly are you trying to do, watermark an existing document? You'll need to do something considerably more elaborate if you want to watermark a document that survives being converted between formats.

Offhand I'm not sure what that would be, since I don't know what the limits of the epub format are in terms of that - but I suppose you could rig up something using Zend_Pdf to open the PDF file, insert the userid/username as text into the document and then it would survive being converted to epub - maybe, depending on where you inserted the text.

Advertisement: