05.05.2013 Views

Programming PHP

Programming PHP

Programming PHP

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Example 10-7. Placing and scaling images (continued)<br />

echo $buf;<br />

pdf_delete($p);<br />

?><br />

Figure 10-7 shows the output of Example 10-7.<br />

Figure 10-7. Placed and scaled images<br />

The scaled versions of the <strong>PHP</strong> logo in Example 10-7 kept their original proportions.<br />

To do nonproportional scaling of an image, you must temporarily scale the coordinate<br />

system via a call to pdf_scale( ):<br />

pdf_scale(pdf, xscale, yscale);<br />

All subsequent coordinates will be multiplied by the xscale and yscale values.<br />

Example 10-8 shows nonproportional scaling in action. Note that we had to compensate<br />

for the coordinate system scaling in the pdf_place_image( ) call to have the<br />

image show up in the right place.<br />

Example 10-8. Nonproportional scaling<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!