I am a newbie with php and I want to play with php and images uploaded.
What are the most used PHP image manipulation classes ?
If you're just starting I'd suggest taking a look at the GD functions. They come with PHP (assuming you have GD enabled).
If you need more power then there's ImageMagick, but you have to install it yourself.
Most used is hard to find but a large list of php classes can be found here:
http://phpclasses.fonant.com/browse/class/11.html
You can do alot with the built in GD graphics library:
http://php.net/manual/en/book.image.php
I am building an easy to use OO image manipulation library with intuitive API. Its publicly available on GitHub - https://github.com/avalanche123/Imagine
Related
is there any way to connect GIMP with PHP and use its libraries?
It seems that all
i do my development use linux as a production server
example for resise image or croping
There is also the GD library which can be used with PHP directly.
http://php.net/manual/en/ref.image.php
imagecrop — Crop an image to the given rectangle
imagescale — Scale an image using the given new width and height
First thing: for resizing or cropping, you really should use some PHP library that integrates with Imagemagick, or something along that.
Now, to actually answer the question "is there any way to connect GIMP with PHP?" - The answer to that is "not directly".
Supposing you want to do extend use of Image manipulation algorithms for some serious project - GIMP engine nowadays is driven by GEGL (Generic Graphics Library) - which has support to binding with any other language through gobject introspection. Now,, gobject introspection can theoretically work with any language - but looking for Gobject Introspection for PHP yields some blog postos form 2011, and some early-stage projects on github. Therefore, although GEGL is what could provide you full image maniulation capabilities, I don't think it can be directly itegrated with PHP due to missing gobject integration. There should be a lot of ways of usig it indirectly, though - by creating some local web-service that would use GEGL to process operations described in XML, for example - such a service could be made in Python or C.
And, finally, for using GIMP's PDB itself, one could craft a Python script that would work as a local webservice relay to GIMP's PDB -so it is also possible in an indirect way.
I like the ImageMagick library, it is more powerful than the GD library. However it doesn't come pre-installed with php you have to do it manually, but if you can do it, it's easy to install with:
sudo apt-get install php5-imagick
The website: https://www.imagemagick.org
The PHP docs: http://php.net/manual/en/book.imagick.php
Background: For an university project I have to use PHP5 to create a web application that also deals with images. I'm not allowed to use any external APIs, frameworks or AJAX.
Is there a native function to resize images in PHP5?
(I know a can specify both width and height for an img tag, but that resizing is done on the client. I'd rather save downsized images on the server.)
The GD library has been bundled with PHP since 4.3, and will do what you want: http://uk.php.net/manual/en/book.image.php. You'll probably want something like imagecopyresampled.
Most PHP installations come bundled with the GD library. In fact, I've yet to come across a PHP installation that doesn't have GD bundled.
MagickWand is not suit, because it doesn't work on simple hosting.
I'm searching for image framework to solve following tasks:
1) Combine images
2) Resize images
I tried to use codeigniter component, but it cannot combine images.
There are at least two: GD, and ImageMagick are both quite popular. GD is well-suited to procedural code, while ImageMagick is well-suited to object-oriented code.
I think GD Library is all you need.
I'm working on a project in PHP that needs to render dynamically-created SVG images to PNG (or GIF if not PNG) format. I know I can do this by invoking a SVG renderer like rsvg, or with an extension like ImageMagick, which isn't that common*.
Is there a "drop-in" style library that can render SVG using things like GD and DomDocument?
* Available in common webhosts and in packages like XAMPP.
To clarify, I already have the SVG itself generated, I just need it to be rendered server-size.
It shouldn't be too hard to do yourself. SVG is a fairly simple specification, so there shouldn't be too much guess work building a converter... The only difficult parts that I can see would be gradients, markers and filters. The rest should be relatively straight forward when looking at the gd functions available.
Obviously, the best would be to find a stand alone library, but if you can't you could always roll one yourself...
If you have Java on the server, you can use Batik's SVG Rasterizer, which comes as a standalone executable JAR. Call it using PHP exec.
Im looking for a PHP library similar to the PHP GD library though having simplified classes.
Any suggestions?
GD is only one library for image processing. PHP also has other library extensions:
ImageMagick a native php extension to create and modify images using the ImageMagick API.
Gmagick a php extension to create, modify and obtain meta information of images using the GraphicsMagick API.
Cairo a native PHP extension to create and modify graphics using the Cairo Graphics Library.
Exif With the exif extension you are able to work with image meta data.
Here is comparison: http://kore-nordmann.de/blog/comparision_of_php_image_libraries.html
Have you tried ImageMagick?
You can use a wrapper library like wideimage, which simplifies the interface to GD.
There is another project that aims to simplify GD called PHP Image Magician that I'd recommend.