• Welcome to Simple Machines Community Forum. Please login or sign up.
October 27, 2021, 10:16:49 PM

News:

SMF 2.0.18 has been released! Please update. Read more.


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.
No good deed goes unpunished
All helpful urges should be circumvented

Advertisement: