Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- set Helvetica as the default font

- don't call ps_get_buffer() if a filename is given (ps_get_buffer()
  doesn't work anyway, due to a bug in the php ps extension)


git-svn-id: https://svn.php.net/repository/pear/packages/Image_Canvas/trunk@262269 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
commit 5d8c7f8b06fa3f27ab563de00c93c143cc580472 1 parent 6ef98ff
Uwe Steinmann authored
Showing with 14 additions and 9 deletions.
  1. +14 −9 Canvas/PS.php
View
23 Canvas/PS.php
@@ -224,6 +224,8 @@ function Image_Canvas_PS($param)
}
}
+ $this->setDefaultFont(array('name' => 'Helvetica', 'color' => 'black', 'size' => 9));
+
if ((isset($param['orientation'])) && (strtoupper($param['orientation']) == 'LANDSCAPE')) {
$w = $this->_pageWidth;
$this->_pageWidth = $this->_pageHeight;
@@ -310,7 +312,7 @@ function Image_Canvas_PS($param)
if (isset($param['filename'])) {
ps_open_file($this->_ps, $param['filename']);
} else {
- ps_open_file($this->_ps, '');
+ ps_open_file($this->_ps);
}
ps_set_parameter($this->_ps, 'warning', 'true');
@@ -859,7 +861,7 @@ function image($params)
$type = 'jpeg';
}
- $image = ps_load_image($this->_ps, $type, realpath($filename), '');
+ $image = ps_open_image_file($this->_ps, $type, realpath($filename), '');
$width_ = ps_get_value($this->_ps, 'imagewidth', $image);
$height_ = ps_get_value($this->_ps, 'imageheight', $image);
@@ -937,14 +939,17 @@ function save($param = false)
ps_end_page($this->_ps);
ps_close($this->_ps);
- $buf = ps_get_buffer($this->_ps);
- $len = strlen($buf);
+ if($param['filename'] == "") {
+ $buf = ps_get_buffer($this->_ps);
+ $len = strlen($buf);
+
+ $fp = @fopen($param['filename'], 'wb');
+ if ($fp) {
+ fwrite($fp, $buf, strlen($buf));
+ fclose($fp);
+ }
+ }
- $fp = @fopen($param['filename'], 'wb');
- if ($fp) {
- fwrite($fp, $buf, strlen($buf));
- fclose($fp);
- }
ps_delete($this->_ps);
}
Please sign in to comment.
Something went wrong with that request. Please try again.