News Feed

News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way
Crop and Resize Images with ImageMagick
May 02, 2013 @ 12:14:51 has a new tutorial posted showing you how to crop and resize images with the help of the ImageMagick functionality that can be added to PHP (via this extension).

If your website allows users to upload photos, image cropping/resizing functionality certainly comes in handy. But users might not have access to image manipulation tools like Photoshop, so by providing a cropping/resizing feature you can allow users to upload photos from any device (e.g. tablets or phones) without them having to worry about the the final size. Furthermore, you can create different versions of the same image and also allow users to crop specific portions of uploaded picture. In this article I'll show you how to create an image cropping tool with the help of the ImageMagick PHP extension.

The post shows the use of the "cropimage" function to trim down an image from its original size and "thumbnailImage" to shrink down the image to make a thumbnail. Also included is the code (both the PHP and the HTML form) to handle file uploads and automatically create a thumbnail image. It outputs the image to the browser and asks the user to select the portion they want thumbnailed (with this jQuery plugin helping).

0 comments voice your opinion now!
crop image imagemagick tutorial resize extension

Create Instagram Filters With PHP
March 26, 2012 @ 10:07:37

On there's a new tutorial showing how you can create Instagram-like filters in PHP using the ImageMagick library/extension.

PHP comes bundled with GD (GIF Draw/Graphics Draw), which is a library for the dynamic creation of images. It can be used for simpler image operation, such as resizing, cropping, adding watermarks, creating thumbnails (Jeffrey wrote about it), applying basic photo filters - you've probably used it before. Unfortunately, if you want to create something more complex with GD, like Instagram effects, you can't. Luckily, though, we have ImageMagick!

He starts off by comparing the two graphics libraries and talks briefly about how to downliad and install Imagemagick on your development platform. Included is a PHP class to help you use it, coming complete with functions for changing the color tone of the image, adding a border and adding a vignette to the image. Also included are some "presets" represented in a few simple functions:

  • Gotham
  • Toaster
  • Nashville
  • Lomo
  • Kelvin

There's also a few links to other resources you can use to find out more details on what Imagemagick has to offer.

0 comments voice your opinion now!
instagraph photo imagemagick filter tutorial image

Martin Psinas' Blog:
Watermarking with text and ImageMagick
October 04, 2011 @ 11:44:35

Martin Psinas has submitted a new tutorial he's written up (complete with sample code) showing how to watermark an image with ImageMagick.

In my most recent venture with PHPMaster I was asked to write an article about watermarking images with PHP using ImageMagick. Virtually no documentation exists on the PHP API, although there are plenty of command-line examples from the official ImageMagick website. I spent a solid day and a half attempting to convert command-line code into PHP before (due to miscommunication) the topic was covered by someone else and my work was no longer needed. Although disappointed, it gave me something to blog about! Yay.

His script is pretty straight forward - it loads a sample image, sets up some watermark text and applies it with a "gravity" setting of "southwest" and adds it to the image (annotateImage). The output is pushed back out as a JPEG image. Also included is a slightly more complex example showing how to give the watermark an embossed look and a "text all over the image" look to prevent use of any part of the image, not just one section.

0 comments voice your opinion now!
watermark text image tutorial imagemagick emboss

Mikko Koppanen's Blog:
Perspective transformations
February 05, 2009 @ 09:36:02

Mikko Koppanen is back to blogging with this new post today - it's a look at another example with ImageMagick. It shows how to distort an image but keep its perspective.

I took some time to actually understand the perspective transformations properly using the excellent ImageMagick examples (mainly created by Anthony Thyssen) as a reference. The basic idea of perspective distortion seems simple: to distort the control points to new locations.

His example uses a checkerboard as the image to manipulate and, based on an array of settings (source, destination) sets control points for the image to twist and turn from. The final output is echoed from a call to distortImage.

0 comments voice your opinion now!
perspective transformation imagemagick twist bendexample

The Bakery:
Five New Articles/Tutorials/Components Posted
June 06, 2008 @ 12:07:47

The Bakery, the CakePHP repository, has had several new components, articles and tutorials posted lately. Here's a list of a few:

Be sure to check out The Bakery for more great articles, tutorial, components and helpers for this flexible framework.

0 comments voice your opinion now!
article post thebakery svn tidy imagemagick mysql

Mikko Koppanen's Blog:
Seam carving
February 13, 2008 @ 17:10:00

Mikko Koppanen has posted another quick hit ImageMagick hint to his blog - this time it deal with "seam carving", a process for cropping and resampling of an image to make a different composite picture.

Today I was reading trough the ImageMagick ChangeLog and noticed an interesting entry. "Add support for liquid rescaling". I rushed to check the MagickWand API docs and there it was: MagickLiquidRescaleImage! After about ten minutes of hacking the Imagick support was done. Needless to say; I was excited

You'll need to have the libqr library compiled into the ImageMagick installation, but the actual use of the functionality is simple - about three or four lines do the work for you. He includes the original image and the result from his test (as well as another example of the same result image scaled down automatically.

0 comments voice your opinion now!
imagemagick seam carving image resize libqr

Mikko Koppanen's Blog:
January 17, 2008 @ 07:58:00

Mikko Koppanen has posted another quick example of using the ImageMagick functionality in PHP - overlaying a string of text over a currently existing image.

Ever had the situation where you have a piece of string which you need to overlay on an image? Maybe a situation where the area reserved for the string is known in pixels but you need to know the font size to fill most of the area? Think no more!

In his example (ready to cut and paste), he defines the text in a variable and, with the help of the newPseudoImage method, adds the text over the top of his sample image. Example input and output is provided.

0 comments voice your opinion now!
imagemagick image graphic typesetting string overlay imagemagick image graphic typesetting string overlay
Create Dynamic Images with ImageMagick
June 26, 2006 @ 06:48:53

Over on today, there's a new tutorial demonstrating an alternative to the usual GD library examples of working with images, opting instead for ImageMagick.

The key component for making dynamic images a reality on your site is an image manipulation program that's controlled by the code that generates your web pages. Even though this article uses PHP as the scripting language, other languages -- such as Perl and Ruby -- can be used just as easily, provided that the image manipulation program that you're considering has an application programming interface (API) for the chosen language.

He decided on ImageMagick for a few reasons, including that it's more supported by web hosts, it runs on Windows and Linux, and it's robust and powerful enough to handle everything from small to large tasks without missing a beat.

That said, he gets into the code, showing how a bit of PHP code can read in an image and spit back out information about it (height, width, etc), force a reduction of an uploaded image, scale down an image to fit a certian size, change it to a different type of image, and image rotation.

2 comments voice your opinion now!
imagemagick dynamic image manipulation extension tutorial imagemagick dynamic image manipulation extension tutorial

Community Events

Don't see your event here?
Let us know!

conference composer install configure extension interview language podcast opinion introduction unittest api laravel release community version voicesoftheelephpant symfony series list

All content copyright, 2015 :: - Powered by the Solar PHP Framework