frocco
(Farocco)
February 25, 2010, 2:26pm
1
Hello,
I have images stored in a database that need to be resized when display in a list (table)
if I just put a height, width, they are distorted.
I only have a blob field, no type or other info.
I am displaying it like:
<img alt="no image" src="data:image/jpg;base64,<?php print base64_encode($row->Picture)?>">
Any idea on what I can do?
Thanks
Frank
wyldie
(Toby Liddicoat)
February 25, 2010, 2:50pm
2
If you’re relying on the HTML renderer to control the size then just placing 1 dimension will scale the image
<img alt="no image" src="data:image/jpg;base64,<?php print base64_encode($row->Picture)?>" height="100">
Alternatively, set the source to a controller/method that reads the data from your table and pass the blob information into an image library such as GD or Imagick and do proper scaling on the server.
CHtml::image($this->createUrl("photo/show", array("id"=>$row->id, "height"=>100, "width"=>100)));