Logo Search packages:      
Sourcecode: acidbase version File versions  Download package

Cpdf::addJpegFromFile ( img,
x,
y,
w = 0,
h = 0 
)

add a JPEG image into the document, from a file

Definition at line 2825 of file class.pdf.php.

References addJpegImage_common().

                                              {
  // attempt to add a jpeg image straight from a file, using no GD commands
  // note that this function is unable to operate on a remote file.

  if (!file_exists($img)){
    return;
  }

  $tmp=getimagesize($img);
  $imageWidth=$tmp[0];
  $imageHeight=$tmp[1];

  if (isset($tmp['channels'])){
    $channels = $tmp['channels'];
  } else {
    $channels = 3;
  }

  if ($w<=0 && $h<=0){
    $w=$imageWidth;
  }
  if ($w==0){
    $w=$h/$imageHeight*$imageWidth;
  }
  if ($h==0){
    $h=$w*$imageHeight/$imageWidth;
  }

  $fp=fopen($img,'rb');

  $tmp = get_magic_quotes_runtime();
  set_magic_quotes_runtime(0);
  $data = fread($fp,filesize($img));
  set_magic_quotes_runtime($tmp);
  
  fclose($fp);

  $this->addJpegImage_common($data,$x,$y,$w,$h,$imageWidth,$imageHeight,$channels);
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index