cvs: pres2 / objects.php

From: Date: Fri, 21 Mar 2003 20:52:16 +0000
Subject: cvs: pres2 / objects.php
Groups: php.pres 
Request: Send a blank email to pres+get-604@lists.php.net to get a copy of this message
sterling Fri Mar 21 15:52:16 2003 EDT Modified files: /pres2 objects.php Log: add the ability to specify image width and height Index: pres2/objects.php diff -u pres2/objects.php:1.134 pres2/objects.php:1.135 --- pres2/objects.php:1.134 Wed Jan 22 10:07:38 2003 +++ pres2/objects.php Fri Mar 21 15:52:15 2003 @@ -871,6 +871,8 @@ $this->marginleft = "auto"; $this->marginright = "auto"; $this->effect = ''; + $this->width = ''; + $this->height = ''; } function display() { @@ -889,10 +891,16 @@ $effect = ''; if($this->effect) $effect = "effect=\"$this->effect\""; if(isset($this->title)) echo '<h1>'.markup_text($this->title)."</h1>\n"; - $size = getimagesize($slideDir.$this->filename); + if ($this->width) { + $size = "width=\"{$this->width}\" height=\"{$this->height}\""; + } else { + $size = getimagesize($slideDir.$this->filename); + $size = $size[3]; + } + ?> <div <?=$effect?> align="<?=$this->align?>" style="margin-left: <?=$this->marginleft?>; margin-right: <?=$this->marginright?>;"> -<img align="<?=$this->align?>" src="<?=$slideDir.$this->filename?>" <?=$size[3]?>> +<img align="<?=$this->align?>" src="<?=$slideDir.$this->filename?>" <?=$size?>> </div> <?php if(isset($this->clear)) echo "<br clear=\"".$this->clear."\"/>\n"; @@ -903,11 +911,16 @@ global $slideDir; if(isset($this->title)) echo '<h1>'.markup_text($this->title)."</h1>\n"; - $size = getimagesize($slideDir.$this->filename); + if ($this->width) { + $size = "width=\"{$this->width}\" height=\"{$this->height}\""; + } else { + $size = getimagesize($slideDir.$this->filename); + $size = $size[3]; + } ?> <div align="<?=$this->align?>" style="margin-left: <?=$this->marginleft?>; margin-right: <?=$this->marginright?>;"> -<img src="<?=$slideDir.$this->filename?>" <?=$size[3]?>> +<img src="<?=$slideDir.$this->filename?>" <?=$size?>> </div> <?php } @@ -930,7 +943,13 @@ pdf_set_font($pdf, $pdf_font , -12, 'winansi'); $cw = pdf_stringwidth($pdf,'m'); // em unit width - list($dx,$dy,$type) = getimagesize($slideDir.$this->filename); + if ($this->width) { + $dx = $this->height; + $dy = $this->width; + list(,,$type) = getimagesize($slideDir.$this->filename); + } else { + list($dx,$dy,$type) = getimagesize($slideDir.$this->filename); + } $dx = $pdf_x*$dx/1024; $dy = $pdf_x*$dy/1024;

« previous php.pres (#604) next »