Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

CodeGeekz:
Cropping Images in PHP Based on their Entropy
Feb 03, 2014 @ 17:25:42

On the CodeGeekz site there's a new post showing you how to use the Imagick extension and a custom library to crop images based on their entropy (keeping the "busiest" part of the image).

The need to resize and crop images in order to create thumbs, is a very common scenario for most websites. For example a blog like this one uses images in the content of the posts, images which at some point are used to create a thumb for the homepage. In most cases, the thumb’s dimensions are not dynamic but are static throughout the website in order to better fit the template. This however creates a major problem when we try to automatically resize and crop our images in the desired dimensions.

He starts with an example of the normal kind of cropping based on a given height and width. He points out an issue with "smart cropping" and resizing the image with the cropping is done. Instead, he's made use of Imagick in his library to produce a better cropped image based on the parts of the image with the most entropy.

tagged: crop image entropy busy resize smart tutorial

Link: http://codegeekz.com/cropping-images-entrop/

PHPMaster.com:
Crop and Resize Images with ImageMagick
May 02, 2013 @ 17:14:51

PHPMaster.com 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).

tagged: crop image imagemagick tutorial resize extension

Link: http://phpmaster.com/crop-and-resize-images-with-imagemagick

Smashing Magazine:
Image Manipulation With jQuery and PHP GD
Apr 05, 2011 @ 17:02:30

Smashing Magazine has a new post today about using jQuery and GD to manipulate images to upload an image, crop it and save that version to the remote server.

One of the numerous advantages brought about by the explosion of jQuery and other JavaScript libraries is the ease with which you can create interactive tools for your site. When combined with server-side technologies such as PHP, this puts a serious amount of power at your finger tips. [...] Sure, there are plugins out there that you can use to do this; but this article aims to show you what’s behind the process. You can download the source files for reference.

They walk you through the little bit of setup you'll need before things will be working and then move right into the upload form and PHP handling that goes with it. The Javascript that goes with it is all home-grown (not a plugin) and cleverly uses a DIV to simulate the bounding box for the crop.

tagged: tutorial image manipulate jquery gd crop

Link:

CodeForest.net:
How to crop an image using jQuery and PHP
Oct 14, 2010 @ 18:49:52

On CodeForest.net there's a new tutorial that merges the power of PHP and the popular jQuery javascript library to create an image cropping tool you can use on your site.

So, your client uploaded the image into your newly, freshly developed CMS and then called you to yell about distorted image, or image that just does not look good? That is a well known scenario. Let me explain a bit what we will achieve today. When your client uploads an image, he is taken to an Image edit area where he sees uploaded image and a smaller preview window. He just needs to drag on the larger image to select crop area and press submit. After that you crop the image using PHP GD functionality and save the new image somewhere on disk.

Their focus is mainly on the image editing part using the ImageAreaSelect jQuery plugin to help with the actual crop size selection. After the selection is finished, though, those values get sent back to a PHP script (via a form) and the resulting image is cropped and saved with help from the GD functionality of PHP.

tagged: crop image jquery tutorial imageareaselect

Link:

Asvin Balloo's Blog:
AJAX image cropper with YUI and PHP
Oct 08, 2008 @ 17:09:21

Asvin Balloo has posted a tutorial that shows how to combine the YUI libraries with PHP to create a simple image cropper.

This post will show you how to build an AJAX crop image tool using the image cropper control from YUI library and PHP. The ImageCropper Control from the YUI library gives you an interactive interface for getting the dimensions to crop an image and using these dimensions in PHP, we can do some cropping.

The script takes in an upload, shows it in the browser for cropping and once altered, pushes the altered image back out as a download. Full code is included as well as a demo of the final result and a sample file to get you started.

tagged: ajax image crop tutorial yui library control

Link:

The Bakery:
Image Resize Helper
Feb 21, 2007 @ 15:48:00

The Bakery has a new helper posted today for those working with images in their applications that need to resize and cache them easily.

This helper resizes an image on the fly and places it in an image cache directory for later use. Make sure your imagecache directory is writable. Future editions could include a cropping function.

The full code of the class is provided in both a cut and paste-able format and for download. There's an example of the sample usage included as well.

tagged: image resize helper cakephpframework download crop image resize helper cakephpframework download crop

Link:

The Bakery:
Image Resize Helper
Feb 21, 2007 @ 15:48:00

The Bakery has a new helper posted today for those working with images in their applications that need to resize and cache them easily.

This helper resizes an image on the fly and places it in an image cache directory for later use. Make sure your imagecache directory is writable. Future editions could include a cropping function.

The full code of the class is provided in both a cut and paste-able format and for download. There's an example of the sample usage included as well.

tagged: image resize helper cakephpframework download crop image resize helper cakephpframework download crop

Link:


Trending Topics: