Using Images in PHP]

Using Images in PHP]

am 14.06.2009 04:36:00 von katiyar76

Hi List,

I have PHP 5.28 with apache 2.2

How can i use images in PHP, i want to create a site where user will
create their profiles.

i heard something about Imagick class, but no idea how to use it,


I mean do in need to install something extra(some extension or what).
because when i write a code something like.

*1. 2. $image = new Imagick('images/pkk.jpg');
3. // If 0 is provided as a width or height parameter,
4. // aspect ratio is maintained
5. $image->thumbnailImage(100, 0);
6. echo $image;
7. ?>

*I get the error on line # 1, that means i am not able to create the
object for I magick class.

i think i need help in installing configuring the Imagick extension.

please suggest.

praveen.,


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Using Images in PHP]

am 14.06.2009 14:47:23 von harlequin2

Good Morning praveen,

you will need both Imagick
http://www.imagemagick.org/script/api.php#php (points to the
documentation about how to use Imagick with PHP)

and the PEAR extension class (PECL):
http://pecl.php.net/package/imagick

There is an alternative to Imagick already shipping with PHP called GD:
http://de2.php.net/manual/de/book.image.php
http://de2.php.net/manual/de/function.imagecopyresized.php#8 8533
(example how to resize images)

Installation is as easy as this:
-> open up php.ini
-> uncomment the following ";extension=php_gd2.dll" (remove the
semicolon before "extension=..")
-> restart Apache

Creating thumbnails is a bit more complicated than with Imagick, but
feel free to use the following class:

http://gist.github.com/129666

It's not complete yet because I wrote it about 1 hour ago, but I hope
I'll find some time to complete it and it already resizes pictures in
PNG and GIF format, JPGs look a bit crappy. It'll hopefully help you
figure out how to resize images with GD.

Best regards,

Sascha

Katiyar (GMail) schrieb:
>
> Hi List,
>
> I have PHP 5.28 with apache 2.2
>
> How can i use images in PHP, i want to create a site where user will
> create their profiles.
>
> i heard something about Imagick class, but no idea how to use it,
>
> I mean do in need to install something extra(some extension or what).
> because when i write a code something like.
>
> *1. > 2. $image = new Imagick('images/pkk.jpg');
> 3. // If 0 is provided as a width or height parameter,
> 4. // aspect ratio is maintained
> 5. $image->thumbnailImage(100, 0);
> 6. echo $image;
> 7. ?>
>
> *I get the error on line # 1, that means i am not able to create the
> object for I magick class.
>
> i think i need help in installing configuring the Imagick extension.
>
> please suggest.
>
> praveen.,
>
>


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Using Images in PHP]

am 15.06.2009 13:30:08 von harlequin2

Hello Nadim,

Nadime wrote:
> Can I resize transparent PNGs and GIFs with the class?

I haven't tested it yet but I guess it -should- work. Best way to find out is to use the class and let me know if you succeeded with resizing transparent images or not. I will modify parts of the class this week (i.e. allow embedding watermarks and improve JPG quality), so it would be great if you could send in your feedback!

Regards, Sascha
--
GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate und Telefonanschluss
für nur 17,95 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php