|
Giovani Thomé - 2013-01-28 13:54:20
Hello!
Great class!
Well, I want use this to show images using your class inside the tag 'img'.
I tryed using this:
$teste=Thumbnails::createThumb('gauchopedia1.jpg','null', 100,100, Thumbnails::IMAGE_CENTER | Thumbnails::IMAGE_TOUCH_OUTSIDE | Thumbnails::IMAGE_POS_RIGHT, Thumbnails::IMAGE_FORMAT_PNG, array('r'=>255,'g'=>255,'b'=>255));
echo "<img src=". $teste . ">";
It didn't work.
Can you help me with this?
Tanks.
Carlos Sosa - 2013-01-30 14:26:44 - In reply to message 1 from Giovani Thomé
Hello Giovanim,
Thanks you for appreciation !
The class was a problem with the method createThumb and destination as NULL, this was corrected and you should update your version of the class.
You also have an error with the NULL value, can't be passed how 'NULL' using quotes.
To create thumbnail:
<?php
$obj=Thumbnails::createThumb('gauchopedia1.jpg', NULL /*Correct NULL Val*/, 100,100, Thumbnails::IMAGE_TOUCH_OUTSIDE | Thumbnails::IMAGE_POS_RIGHT, Thumbnails::IMAGE_FORMAT_PNG, array('r'=>255,'g'=>255,'b'=>255));
//Into a variable:
$img = $obj->getThumbnailAsString();
echo '<img src="data:image/png;base64,'. base64_encode($img) .'">';
//or Print:
header("Pragma: public");
header('Content-disposition: filename=image_thumb.png');
header("Content-type: image/png");
header('Content-Transfer-Encoding: binary');
ob_clean();
flush();
//Using simplified method
$obj->printThumbnail();
?>
You can also find more examples into the source code of the class.
I will plan expand the features of the class. Allowing transparent color, pass colors as hex value or the name, and another many things. You can follow me in GitHub https://github.com/carlossosa/Thumbnails.
|