News Feed
Sections




News Archive
feed this:

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
February 03, 2014 @ 11: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.

0 comments voice your opinion now!
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 @ 12: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).

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

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

NETTUTS.com:
Image Resizing Made Easy with PHP
March 19, 2010 @ 08:47:48

New from NETTUTS.com there's a recent tutorial showing you how to use the GD graphics library (bundled with PHP) to resize images on the fly.

Ever wanted an all purpose, easy to use method of resizing your images in PHP? Well that's what PHP classes are for '" reusable pieces of functionality that we call to do the dirty work behind the scenes. We're going to learn how to create our own class that will be well constructed, as well as expandable. Resizing should be easy.

The simple eleven-step process (don't worry, it sounds worse than it is) has you go from a basic image and, with the help of a custom PHP class, create a resized image based on a type such as "landscape", "auto" or "exact". Full code is included for you to cut and paste or you can download the source and have the full code ready and waiting.

2 comments voice your opinion now!
image resize tutorial gd graphic library


Kae Verens' Blog:
pre-parsing HTML for incorrectly-sized images
July 29, 2008 @ 12:03:55

Kae Verens has a recent blog post that looks at a method for helping to protect users from themselves when working with images - a method for handling ones incorrectly sized.

Every now and then, I get a call from a client who is puzzled why their site is running slow. I would look at their page and see an innocuous image inserted into a paragraph. When I examine the image, though, I see that the client has artificially resized the image using HTML. One recent example showed on-screen as a 300px-wide image. When I examined it, it was actually 3000px wide (approx).

The script looks through some HTML markup and, based on the sizes in the image tags, resizes the images appropriately. An example and the source are provided.

0 comments voice your opinion now!
html image size height width parse resize


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


The Bakery:
Image Resize Helper
February 21, 2007 @ 09: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.

1 comment voice your opinion now!
image resize helper cakephpframework download crop image resize helper cakephpframework download crop


Stoyan Stefanov's Blog:
Laziest image resize in PHP
December 14, 2006 @ 09:19:00

On phpied.com, there's this new post that shares Stoyan's lazy way to resize images in PHP - with the help of the PEAR::Image_Transform package.

Today I saw a post at digg.com on image resizing with PHP and there was quite a discussion. Let me share the laziest way (that I know of) how to do it - PEAR::Image_Transform is all it takes.

His code is only five lines log and takes in a JPG image and resizes it down to a 100x100 pixel image to output as a PNG. He also mentions some of the other functionality the package has, including lots of other image manipulation extensions.

2 comments voice your opinion now!
image resize pear package imagetransform image resize pear package imagetransform


SpinDrop.us:
Cropping Images using DHTML (Prototype) and symfony
September 16, 2006 @ 16:29:53

From the SpinDrop.us blog, there's a new tutorial on combining the power of dynamic HTML and PHP to create an image cropping script for your website.

Years ago when I was working on a photo gallery for davedash.com I got the art of making tumbnails down fairly well. It was automated and didn't allow for specifying how the thumbnail should be made. With dozens of photos (which was a lot back then), when would I find that kind of time.

Flashback to today, for my company... we want users with avatars... but nothing too large. Maybe a nice 80x80 picture. Well the coolest UI I've seen was Apple's Address Book which let you use this slider mechanism to crop a fixed sized image from a larger image.

They create a pretty slick little app, using symfony to handle the framework for the app, some Javascript in the form of Prototype to make the controls, and plenty of CSS/HTML to make it usable. You can check out the demo here.

1 comment voice your opinion now!
cropping images dhtml prototype css frontend resize symfony cropping images dhtml prototype css frontend resize symfony


Zend Developer Zone:
Cool Image Thumbnail Class
August 30, 2006 @ 07:41:58

On the Zend Developer Zone, they point out a handy little image manipulation class they've come across - GenXDesign's PHP Thumbnail Class - as well as some details about it.

I've seen a lot of implementations of thumb nail functionality in PHP, I've even written a couple of my own. I like this class thought. In looking over the code the first thing you notice is that it's clean code. I don't mean they use the latest whiz-bang method to cshave a few keystrokes.

This code is simple, nicely formatted and easy to read through. My only real problem with the code itself is that it is not terribly well documented. That can be forgiven since easy to read.

Cal talks about some of the other features of the class, including that it works with gif/jpeg/png images, makes it easy to set the quality of the jpgs, and makes it easy to display the dynamic images directly to the browser. Check out the demo for more.

0 comments voice your opinion now!
image thumbnail class genxdesign gif jpeg png quality resize image thumbnail class genxdesign gif jpeg png quality resize


PHPit.net:
Image manipulation with PHP & the GD library (Part 2)
August 14, 2006 @ 13:39:51

New on PHPit.net today is part two of their series covering working with images in PHP through the GD graphics library.

In this second part of the "Image manipulation with PHP & the GD library" article series you will learn how to resize images, create thumbnails, watermark images and more.

They start with resizing images, showing how to grab the current size and alter it to modify the output (both in a set and proportional way). With that code in place, they take the next logical step - an automatic thumbnail creator from a file upload. Finally, they show how to help protect your images using a watermark - their example is a "Image by YourWebsite.com" string of text placed on the image.

0 comments voice your opinion now!
image manipulation part2 gd watermark thumbnail resize image manipulation part2 gd watermark thumbnail resize



Community Events





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


refactor symfony2 opinion series threedevsandamaybe testing api laravel unittest introduction community framework podcast code language interview list install developer release

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework