Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Zend Pdf Images help.

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
Watch

pixelbypixel

Established Member
Impact
38
Hey,

Using Zend for pdf generation, which is all working fine and dandy.

However, I wish to include an image in the pdf which is user uploaded.
The upload works fine. Inserting the image into the PDF is fine.

My problem is, I want the image to be its original size, without forcing a fixed area for the image to 'fill'.
As it stands Zend_Pdf stretches the image to fill the area, or shrinks it to do so.

What I want is the image to stay at its real dimensions.

Currently I am using:

PHP:
	// Draw Logo 
		$imagePath = "../users/".$this->user."/logo.jpg";
		$image = Zend_Pdf_Image::imageWithPath($imagePath); 
		$page->drawImage($image, 50, 720, 400, 860);

The logo.jpg file is in reality 334 x 112. Which may vary depending on the users own logo.
What I am asking is, is there any way to get the dimensions of $image directly using Zend? Or am I going to have to use GD, if so, how would it be done using GD? (not used images in this way before)


Thanks for any help.
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
No one can point me in the right direction at least? :(
 
0
Close
You could get the image dimensions and use them when drawing the image. For example,

PHP:
        // Draw Logo 
        $imagePath = "../users/".$this->user."/logo.jpg";
        list($width, $height, $type, $attr) = getimagesize($imagePath);
        $image = Zend_Pdf_Image::imageWithPath($imagePath); 
        $page->drawImage($image, 50, 720, 50+$width, 720+$height);
 
1
Close
Thanks, ill try that later =]
 
0
Close
Great, works just as required. Thanks
 
0
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back