PHP and Image processing

PHP and Image processing

am 17.04.2008 22:25:49 von Amit

Hello group,


Few weeks ago, somebody suggested me to use Imagick for image
manipulation/processing. I installed it and now want to start learning
it so I did start with an example but what other steps should I take
after installation?
As you know better I need to instantiate an object from a class but
there is no any include file to add the library to my project!

Can somebody please give me some hints on this?


Thanks,
Amit

Re: PHP and Image processing

am 18.04.2008 00:06:28 von Hans-Peter Sauer






> Hello group,
>
>
> Few weeks ago, somebody suggested me to use Imagick for image
> manipulation/processing. I installed it and now want to start learning
> it so I did start with an example but what other steps should I take
> after installation?
> As you know better I need to instantiate an object from a class but
> there is no any include file to add the library to my project!
>
> Can somebody please give me some hints on this?
>

When i posted some code the other week to help you - the only thing you
did was critisise the way i named some variables - and to say you got a
division by zero .

While the slagging of the variable names i can accept - but its clear
you didnt actually even try the code before before altering it .

IMHO if you alter the code before even trying it to see if it worked or
not - then you are a idiot .

For if you had bothered to actually ask - then i would have told you
that you needed to change another part of the code if you changed the
maximum width/height dimentions of the thumbnail .

= you are a idiot who thinks they know everything but still asks for
help in how to do stuff .


--
www.krustov.co.uk

Re: PHP and Image processing

am 18.04.2008 01:02:11 von Amit

On Apr 17, 3:06=A0pm, Krustov wrote:
>
>
>
>
>
> > Hello group,
>
> > Few weeks ago, somebody suggested me to use Imagick for image
> > manipulation/processing. I installed it and now want to start learning
> > it so I did start with an example but what other steps should I take
> > after installation?
> > As you know better I need to instantiate an object from a class but
> > there is no any include file to add the library to my project!
>
> > Can somebody please give me some hints on this?
>
> When i posted some code the other week to help you - the only thing you
> did was critisise the way i named some variables - and to say you got a
> division by zero .
>
> While the slagging of the variable names i can accept - but its clear
> you didnt actually even try the code before before altering it .
>
> IMHO if you alter the code before even trying it to see if it worked or
> not - then you are a idiot .
>
> For if you had bothered to actually ask - then i would have told you
> that you needed to change another part of the code if you changed the
> maximum width/height dimentions of the thumbnail .
>
> =3D you are a idiot who thinks they know everything but still asks for
> help in how to do stuff .
>
> --www.krustov.co.uk


Hi Krustov,

I don't what you are mad about but this is what I found in that post.
I totally don't understand what part of it was critisizing you. Check
it out:

>Thank you but it is so confusing the way it is written in terms of
>variable names. Also, I get so many division by zero.

The reason I didn't touch the code beacuse I just started learning PHP
in few weeks and didn't want to mess with the code since I don't know
everything. Do you change code before you learn or understand it?

BTW, did I use any bad names or did I insult you?!! I just said I'm
getting division by zero and did thank you in advance and I didin't
criticised you or your code!

However, I personally don't consider a PHP forum as a place to insult
people either they deserve it or not. BUT that's OK. Let's forget that
and again I thank you for your help in that post again. Good luck and
if you think I have attached you then I apologize you.

so let it go!!!

Re: PHP and Image processing

am 18.04.2008 08:40:39 von Tim Roberts

amit wrote:
>
>Few weeks ago, somebody suggested me to use Imagick for image
>manipulation/processing. I installed it and now want to start learning
>it so I did start with an example but what other steps should I take
>after installation?
>As you know better I need to instantiate an object from a class but
>there is no any include file to add the library to my project!

It's a native extension. That means the class is available without having
to import anything, just like the other extensions (for example, Postgres
or MySQL).

Didn't you look at ANY of the examples in the documentation? That's what
they're there for.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Re: PHP and Image processing

am 18.04.2008 13:10:38 von piotr

Tim Roberts wrote:
> It's a native extension. That means the class is available without having
> to import anything, just like the other extensions (for example, Postgres
> or MySQL).

Afaik, it's native from php 5.1.3.
Also, it's still marked as experimental, and I'm not sure if it's
bundled with windows version. Manual mentions the need to download
binaries from imagemagic.org

to Amit:
After you download the extension binaries. Put the dll into your
extensions direcotry, and make sure your php.ini files has following line:
extension=php_imagick.dll

best regards
Piotr N

Re: PHP and Image processing

am 21.04.2008 20:44:46 von Amit

On Apr 18, 4:10=A0am, Piotr wrote:
> Tim Roberts wrote:
> > It's a native extension. =A0That means the class is available without ha=
ving
> > to import anything, just like the other extensions (for example, Postgre=
s
> > or MySQL).
>
> Afaik, it's native from php 5.1.3.
> Also, it's still marked as experimental, and I'm not sure if it's
> bundled with windows version. Manual mentions the need to download
> binaries from imagemagic.org
>
> to Amit:
> After you download the extension binaries. Put the dll into your
> extensions direcotry, and make sure your php.ini files has following line:=

> extension=3Dphp_imagick.dll
>
> best regards
> Piotr N


Hello Tim and Piotr,

Thanks for your response but I am not using Windows server instead
using using Linux which as far as I know it doesn't have dll file. Or
maybe the file you are taking about works for Linux as well. I'm new
to PHP and not familiar with these steps.

Ok, what I did was installing it from http://www.imagemagick.org/script/inst=
all-source.php
Then I followed all steps which finally after verification it was able
to create a GIF file. Now, I don't know how to include it in my code.
Once I tried to run it and PHP was complaining about new() operator.

Any advice is appreciated.

Regards.

Re: PHP and Image processing

am 21.04.2008 23:13:17 von piotr

amit wrote:

> Ok, what I did was installing it from http://www.imagemagick.org/script/install-source.php
> Then I followed all steps which finally after verification it was able
> to create a GIF file. Now, I don't know how to include it in my code.
> Once I tried to run it and PHP was complaining about new() operator.
>
> Any advice is appreciated.


Link you provided refers to ImageMagic alone, what you need to do,
is to add imagemagic extension to your PHP. Easiest way to do that,
will be to launch your system packed manager (software installation
tool) and search for php and imagemagic. You should find packed that
provides that. Most popular distributions should provide that. Although
you might need additional repositories. You can also seek for a packed
in google and download and install it.

You might also try using PECL installer to add imagick,
to do so, issue:
pecl install imagick
Note that you might need to be root to complete the installation.

If you have PHP > 5.1.3, then needed extension might already be present.
To check it, issue in your console:
php -i |grep imagick
If you get some data, then it's present.


Once the extension is loaded, you can simply use it's functions and
objects. You need not 'import' or 'include' anything.

Here is PHP image magic function reference:
http://pl.php.net/manual/pl/book.imagick.php

PS. Keep in mind, that most hosting companies do not provide this
extension. Another image library, called GD is usually compiled into PHP
and available on most hosting servers.

best regards
Piotr N

Re: PHP and Image processing

am 22.04.2008 19:49:26 von Amit

On Apr 21, 2:13=A0pm, Piotr wrote:
> amit wrote:
> > Ok, what I did was installing it fromhttp://www.imagemagick.org/script/i=
nstall-source.php
> > Then I followed all steps which finally after verification it was able
> > to create a GIF file. Now, I don't know how to include it in my code.
> > Once I tried to run it andPHPwas complaining about new() operator.
>
> > Any advice is appreciated.
>
> Link you provided refers to ImageMagic alone, what you need to do,
> is to add imagemagic extension to yourPHP. Easiest way to do that,
> will be to launch your system packed manager (software installation
> tool) and search for =A0phpand imagemagic. You should find packed that
> provides that. Most popular distributions should provide that. Although
> you might need additional repositories. You can also seek for a packed
> in google and download and install it.
>
> You might also try using PECL installer to add imagick,
> to do so, issue:
> pecl install imagick
> Note that you might need to be root to complete the installation.
>
> If you havePHP> 5.1.3, then needed extension might already be present.
> To check it, issue in your console:php-i |grep imagick
> If you get some data, then it's present.
>
> Once the extension is loaded, you can simply use it's functions and
> objects. You need not 'import' or 'include' anything.
>
> Here isPHPimagemagic function reference:http://pl.php.net/manual/pl/book.i=
magick.php
>
> PS. Keep in mind, that most hosting companies do not provide this
> extension. Anotherimagelibrary, called GD is usually compiled intoPHP
> and available on most hosting servers.
>
> best regards
> Piotr N


Hi Piotr,

Thank you so much for your the information.
1) Are you saying that I only have installed Image_Magick but must add
its PHP extension as well?
2) Is this a good place to install it? (http://php.net/manual/en/
install.pecl.php)
3) and then the extension from http://pecl.php.net/package/imagick ?

Please let me know this .


All the best,
Amit

Re: PHP and Image processing

am 22.04.2008 19:51:12 von Amit

On Apr 22, 10:49=A0am, amit wrote:
> On Apr 21, 2:13=A0pm, Piotr wrote:
>
>
>
>
>
> > amit wrote:
> > > Ok, what I did was installing it fromhttp://www.imagemagick.org/script=
/install-source.php
> > > Then I followed all steps which finally after verification it was able=

> > > to create a GIF file. Now, I don't know how to include it in my code.
> > > Once I tried to run it andPHPwas complaining about new() operator.
>
> > > Any advice is appreciated.
>
> > Link you provided refers to ImageMagic alone, what you need to do,
> > is to add imagemagic extension to yourPHP. Easiest way to do that,
> > will be to launch your system packed manager (software installation
> > tool) and search for =A0phpand imagemagic. You should find packed that
> > provides that. Most popular distributions should provide that. Although
> > you might need additional repositories. You can also seek for a packed
> > in google and download and install it.
>
> > You might also try using PECL installer to add imagick,
> > to do so, issue:
> > pecl install imagick
> > Note that you might need to be root to complete the installation.
>
> > If you havePHP> 5.1.3, then needed extension might already be present.
> > To check it, issue in your console:php-i |grep imagick
> > If you get some data, then it's present.
>
> > Once the extension is loaded, you can simply use it's functions and
> > objects. You need not 'import' or 'include' anything.
>
> > Here isPHPimagemagic function reference:http://pl.php.net/manual/pl/book=
..imagick.php
>
> > PS. Keep in mind, that most hosting companies do not provide this
> > extension. Anotherimagelibrary, called GD is usually compiled intoPHP
> > and available on most hosting servers.
>
> > best regards
> > Piotr N
>
> Hi Piotr,
>
> Thank you so much for your the information.
> 1) Are you saying that I only have installed Image_Magick but must add
> itsPHPextension as well?
> 2) Is this a good place to install it? (http://php.net/manual/en/
> install.pecl.php)
> 3) and =A0then the extension fromhttp://pecl.php.net/package/imagick?
>
> Please let me know this .
>
> All the best,
> Amit- Hide quoted text -
>
> - Show quoted text -


Also, when I run:

pecl install imagick


I get: -bash: pecl: command not found

so I guess I have to install pecl as well.


Thanks.

Re: PHP and Image processing

am 23.04.2008 02:34:33 von Courtney

amit wrote:
> On Apr 22, 10:49 am, amit wrote:
>> On Apr 21, 2:13 pm, Piotr wrote:
>>
>>
>>
>>
>>
>>> amit wrote:
>>>> Ok, what I did was installing it fromhttp://www.imagemagick.org/script/install-source.php
>>>> Then I followed all steps which finally after verification it was able
>>>> to create a GIF file. Now, I don't know how to include it in my code.
>>>> Once I tried to run it andPHPwas complaining about new() operator.
>>>> Any advice is appreciated.
>>> Link you provided refers to ImageMagic alone, what you need to do,
>>> is to add imagemagic extension to yourPHP. Easiest way to do that,
>>> will be to launch your system packed manager (software installation
>>> tool) and search for phpand imagemagic. You should find packed that
>>> provides that. Most popular distributions should provide that. Although
>>> you might need additional repositories. You can also seek for a packed
>>> in google and download and install it.
>>> You might also try using PECL installer to add imagick,
>>> to do so, issue:
>>> pecl install imagick
>>> Note that you might need to be root to complete the installation.
>>> If you havePHP> 5.1.3, then needed extension might already be present.
>>> To check it, issue in your console:php-i |grep imagick
>>> If you get some data, then it's present.
>>> Once the extension is loaded, you can simply use it's functions and
>>> objects. You need not 'import' or 'include' anything.
>>> Here isPHPimagemagic function reference:http://pl.php.net/manual/pl/book.imagick.php
>>> PS. Keep in mind, that most hosting companies do not provide this
>>> extension. Anotherimagelibrary, called GD is usually compiled intoPHP
>>> and available on most hosting servers.
>>> best regards
>>> Piotr N
>> Hi Piotr,
>>
>> Thank you so much for your the information.
>> 1) Are you saying that I only have installed Image_Magick but must add
>> itsPHPextension as well?
>> 2) Is this a good place to install it? (http://php.net/manual/en/
>> install.pecl.php)
>> 3) and then the extension fromhttp://pecl.php.net/package/imagick?
>>
>> Please let me know this .
>>
>> All the best,
>> Amit- Hide quoted text -
>>
>> - Show quoted text -
>
>
> Also, when I run:
>
> pecl install imagick
>
>
> I get: -bash: pecl: command not found
>
> so I guess I have to install pecl as well.
>
>
> Thanks.
>
the pain doesn't stop there.

I gave up on ImageMagick and found a smaller library that did all I needed.

Re: PHP and Image processing

am 23.04.2008 10:11:19 von piotr

amit wrote:
>> Thank you so much for your the information.
>> 1) Are you saying that I only have installed Image_Magick but must add
>> itsPHPextension as well?

Yes, that is what I suspect.

>> 2) Is this a good place to install it? (http://php.net/manual/en/
>> install.pecl.php)
>> 3) and ?then the extension fromhttp://pecl.php.net/package/imagick?

Yes, ussing PECL installer might be a good solution, but as i recomended
before, *first* try using your distribution software installer tool.

> I get: -bash: pecl: command not found
> so I guess I have to install pecl as well.

Again, try using your linux software installer tool to add pecl.
It will save you alot of pain.

best regards
Piotr N