Jonathan Morgan Design, Justice, Jesus, Music, Life

ExpressionEngine: File Upload extension

Until yesterday I felt that the biggest weakness in using ExpressionEngine as a Content Management System was its roundabout way of handling image and file uploads. For my less tech-savvy clients this was particularly troublesome because it meant that some of them felt they were unable to upload images themselves.

However yesterday I discovered Mark Huot’s File Upload Extension. The extension makes managing files much easier, giving users a simple ‘browse’ button for searching their hard drive, and even manages resizing and cropping site wide (without users ever having to face questions like “would you like to resize your image,” or “would you like to delete the original?”

I did, however, have to customize the extension slightly due to the fact that images with a .jpg file extension were pixelating. After a quick search of the forums I discovered that if I replaced the following code (in the extension file, under the heading ‘Write File’):

if(@imagegif($dst_img, $dst) !== false) {}
else if(@imagejpeg($dst_img, $dst) !== false) {}
else if(@imagepng($dst_img, $dst) !== false) {}

With:
if(@imagejpeg($dst_img, $dst, 90) !== false) {}
else if(@imagegif($dst_img, $dst) !== false) {}
else if(@imagepng($dst_img, $dst) !== false) {}

I could avoid this pixelation and display better quality images.

Update:
I’ve been using this extension on a Windows 2003 server and had some difficulties with the extension accepting the server paths. This post helped me resolve the issue.


No Comments Yet


There are no comments yet. You could be the first!

Leave a Comment

A poor photographer blames his tools ExpressionEngine: adding easy file upload to SAEF