|
Resizing Images with PHP and Mogrify
John Masterson
One of the challenges for any web development team is creating systems
that are technically robust while still being intuitive to users. It's
especially important to keep in mind the level of technical proficiency of
the intended users of the system. We were reminded of this crucial truism
shortly after the initial launch of a site we recently built.
Our consulting division had been approached by a economic development
organization who wanted us to build a website. One of the desired features
of the site was a system that allowed their staff to upload member company
logos to be displayed on the front page of their site, as well as in a
member directory section. The intent was that businesses would send their
logos to the organization staff, and they'd use the system to insert the
new logos and descriptive text into a database. No problem, right?
Because Modwest runs PHP as a chrooted CGI, it was easy to use standard PHP
upload features to get the logos from the client's personal computer
up to the server and into a database. (See
php.net/manual/en/features.file-upload.php for the basics.) What we
originally failed to account for was the size of the uploaded images.
The Problem Unveiled
The launch of the site went nicely, and the first few logos uploaded fit
the design of the site nicely. A few weeks down the line, a business sent in
a logo that was over 800 pixels wide. Of course, as soon as the staff uploaded
it into the system, it wrecked the design of the site, as the logos were
meant to be displayed in columns that were only about 250 pixels wide. The
staff member responsible for uploading called us immediately, wondering why
our system had broken. Of course, the system was doing exactly as it was told.
Our first tactic was to suggest that the staff member resize logos to be no
more than 200 pixels wide. This suggestion may have worked if we were talking
to a graphics-savvy user, but this individual wasn't terribly comfortable
using Windows Paint (the only graphics program they had available). So, we
needed a solution that would auto-resize photos appropriately and maintain
their original proportions to prevent any distortion.
[ Next Page ]
| Comments: | ||
| Professional class to deal with images | Yuriy Horobey | 10/15/05 06:30 |
| Perlmagick | Wayne | 04/11/05 12:02 |
| RE: Thumbnail-ing with mogrify | ymhuu | 03/16/03 13:41 |
| RE: White Space | matthew | 03/04/03 09:41 |
| RE: It won't work. | Del Langrish | 01/29/03 05:17 |
| It won't work. | Marian | 01/13/03 08:31 |
| RE: imagemagick | Michael Montero | 11/22/02 08:53 |
| Clipping path - Possible? | Kim Steinhaug | 11/07/02 19:57 |
| RE: GD quality | Rasmus Hansen | 10/16/02 10:44 |
| GD quality | Yuriy Horobey | 09/22/02 16:22 |
| exec and IM does not work | Gune | 09/19/02 08:42 |
| TIFF (CMYK) to JPG (RGB) | Josep | 09/13/02 06:42 |
| Temporary Images | Sam Mateosian | 09/09/02 12:42 |
| RE: White Space | Si Watts | 08/19/02 19:21 |
| White Space | Leon Letto | 08/16/02 21:20 |
| RE: Uploading images | Si Watts | 08/11/02 14:04 |
| RE: Thumbnail-ing with mogrify | Si Watts | 08/11/02 14:01 |
| Uploading images | Praggers | 08/09/02 05:56 |
| RE: Thumbnail-ing with mogrify | Stephen | 08/08/02 13:31 |
| RE: Thumbnail-ing with mogrify | Matthew Calthrop | 08/06/02 09:28 |
| Thumbnail-ing with mogrify | Thorsten clausen | 08/02/02 05:15 |
| No library | thrive | 07/29/02 15:01 |
| Did it with netpbm package | Gabe Miano | 07/28/02 10:59 |
| RE: imagemagick | Si Watts | 07/25/02 18:30 |
| RE: Flipping image | Si Watts | 07/25/02 18:25 |
| RE: Follow up for Mogrify -geometry | Si Watts | 07/25/02 18:21 |
| GD&Truecolors | Yuriy Horobey | 07/25/02 15:51 |
| Flipping image | Smarone | 07/24/02 10:33 |
| RE: imagemagick | Randy | 07/24/02 10:01 |
| RE: Follow up for Mogrify -geometry | Jimcurry | 07/24/02 02:29 |
| Follow up for Mogrify -geometry | Si Watts | 07/23/02 11:18 |
| RE: I did it only with PHP/GD (on PUBLIC serv | Yuriy Horobey | 07/23/02 03:52 |
| Professional PHP4 Multimedia Programming | the_phpfreak | 07/23/02 01:46 |
| Did this also | Alex | 07/22/02 16:32 |
| RE: I did it only with PHP/GD (on PUBLIC serv | squashee | 07/22/02 05:41 |
| -geometry | Si Watts | 07/21/02 19:48 |
| RE: I did it only with PHP/GD (on PUBLIC server) | Daniel Higgins | 07/19/02 11:36 |
| RE: imagemagick | bill griffith | 07/18/02 21:17 |
| GD/GIF support | Michael | 07/18/02 17:12 |
| RE: imagemagick | Ben Smith | 07/18/02 12:33 |
| RE: RE: imagemagick | Trebel | 07/18/02 06:09 |
| RE: PHP JPGResizer | yuriy horobey | 07/18/02 03:59 |
| PHP JPGResizer | BankHacker | 07/17/02 16:14 |
| I did it only with PHP/GD (on PUBLIC server) | Yuriy Horobey | 07/17/02 15:48 |
| Little improvement... | HaploZ | 07/17/02 14:10 |
| RE: imagemagick | Joystickit | 07/15/02 19:50 |
| imagemagick | gabe | 07/15/02 13:52 |
| On a public server? | Adam | 07/14/02 21:08 |
| -geometry | Andy | 07/12/02 14:40 |
|
If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly. | ||


