Changelogs: Uploader v4.4.0

A new version of Uploader has been released, version 4.4.0. Please download the new tag or view the documentation. If you have any questions, be sure to send me an email or comment on this post. If you run into any problems, report an issue on the GitHub repository.

Version: 4.4.0
Tested On: PHP 5.4.3, CakePHP 2.3.8, Composer
Requires: PHP 5.3, CakePHP 2.3, Composer
Commit Hash: cd5b91840a6910cd93bfd3a9791285be98460ffe
Changes:

  • Includes changes from previous versions
  • Fixed interface changes for CakePHP 2.4
  • Fixed an issue with file validation failing on PHP 5.3 [#136]
  • Fixed empty upload error logging problem [#152]
  • Fixed record deletion problem because of invalid model ID [#149]
  • Refactored so that defaultPath is applied in afterFind() [#147]
  • Added support for custom transformers and transporters

Changelogs: Uploader v4.3.0

A new version of Uploader has been released, version 4.3.0. Please download the new tag or view the documentation. If you have any questions, be sure to send me an email or comment on this post. If you run into any problems, report an issue on the GitHub repository.

Version: 4.3.0
Tested On: PHP 5.4.3, CakePHP 2.3.6, Composer
Requires: PHP 5.3, CakePHP 2.3, Composer
Commit Hash: 6bcd77330c5e7a4ce62f60d633b19dfba05e6a50
Changes:

  • Includes changes from previous minor versions
  • Updated Transit to v1.4.0
  • Added transportDir setting for uploads and transforms which allow custom transport directory paths [Issue #125]
  • Added fit transformer that allows for fitting an image to a certain size while applying a background fill
  • Added 4th argument to AttachmentBehavior.deleteFiles() to circumvent database hit
  • Reversed move and rename logic so transformed files do not conflict
  • Fixed bug where empty file paths trigger error on deletion [Issue #126]

Changelogs: Uploader v4.2.0

A new version of Uploader has been released, version 4.2.0. Please download the new tag or view the documentation. If you have any questions, be sure to send me an email or comment on this post. If you run into any problems, report an issue on the GitHub repository.

Version: 4.2.0
Tested On: PHP 5.4.3, CakePHP 2.3.1, Composer
Requires: PHP 5.3.3, CakePHP 2, Composer
Commit Hash: 7164f34197bcf8844f880af714929eb9efbdfaec
Changes:

  • Updated Transit requirement to 1.3
  • Added a rotate transformer that accepts a degrees setting
  • Added a exif transformer that fixes orientation and strips Exif data (should be applied first with self)
  • Added a defaultPath setting to transforms

Changelogs: Uploader v4.1.0

A new version of Uploader has been released, version 4.1.0. Please download the new tag or view the documentation. If you have any questions, be sure to send me an email or comment on this post. If you run into any problems, report an issue on the GitHub repository.

Version: 4.1.0
Tested On: PHP 5.4.3, CakePHP 2.3.1, Composer
Requires: PHP 5.3, CakePHP 2, Composer
Commit Hash: f2cad62f01c8aedc262692a54ea5d5ed272f4224
Changes:

  • Includes changes from 4.0.12 - 4.0.15
  • Updated Transit requirement to 1.2
  • Updated extension parsing to extract the value from the filename
  • Updated mimetype parsing to extract the value from multiple sources: file -b --mime command, then fileinfo, then $_FILES['type']
  • Fixed a bug where beforeUpload(), beforeTransform() and beforeTransport() callbacks were not being triggered for record deletions
  • Fixed a bug where $this->data is not available within callbacks

Important uploader changes

There are a few Uploader changes that I made this week that everyone should be aware of. Simple change logs will not suffice, so I will briefly talk about the changes.

Why not a minor version upgrade?

You're right, it should be a minor version instead of a patch. I was trying to be hasty and screwed that up and now it's too late. This post is also to warn anyone updating via Composer without checking the changes.

Amazon S3 endpoints

Last week Amazon changed their AWS SDK and in the process broke the S3 URLs (endpoints) that are generated via the Uploader and Transit. I quickly fixed this once it was brought to my attention, however, if anyone was uploading files during this time frame, the S3 transport would of failed and will continue to fail until Transit is updated.

Imported file validation

File validation up to this point was only for literal file uploads and not imports. After many requests I decided to add file validation to importing files. The process and configuration should be the same for both uploads and imports. I also updated Transit to import files under https.

Extension detection

In the past, the extension of a file was determined by the ending characters in the literal filename. This was changed and it will now determine the extension based off the files mime type (image/jpeg = jpg, etc). This provides support for files that do not have extensions, but are true files (primarily applies to URLs).

Swapped type/mimeType validation rules

These 2 validation rules continue to confuse people, and it confused me also as the terminology is backwards. I decided to swap the functionality of these, which in turn will break backwards compatibility. The way these should work is as so:

If type equals "image" then all image mime types will pass (image/jpeg, image/png, etc). This allows for easy validation of all images instead of defining mime types for each one. The type value can be anything before the / in the mime type declarations.

As for mimeType, this should equate to the literal mime type value: image/png, text/html, audio/mp3, etc.

I may combine these into a single validation rule to remove the confusion that they cause.

Upgrade now!

Please update to Uploader v4.0.9 and Transit v1.0.7 immediately, especially if you are using Amazon S3.

Changelogs: Uploader v4.0.0

A new version of Uploader has been released, version 4.0.0. Please download the new tag or view the documentation. If you have any questions, be sure to send me an email or comment on this post. If you run into any problems, be sure to report an issue on the Github repository.

Version: 4.0.0
Tested On: PHP 5.4
Requires: PHP 5.3
Commit Hash: f4d115ff504abdb8b1c7e508ae530300ef53409c
Changes:

  • Updated to use Composer extensively
  • Updated to use Transit and AWS SDK internally
  • Uploader and S3 classes have been removed (uploading is done purely in the model layer)
  • Transformations can be applied to the original file or used to create new files
  • Transformations now support the following options: nameCallback, append, prepend, uploadDir, finalPath, overwrite and self
  • Added Model::deleteImages($id) to delete uploaded files and not the record
  • Added automatic file deletion when a record is deleted, or a path is being overwritten with a record update
  • Added built in support for file uploading and importing (local, remote or stream)
  • Added rollback file deletion if the upload process fails
  • Added Model::beforeTransport() callback
  • Added logging for critical errors
  • Added AWS S3 and Glacier transport support
  • Added type and mimeType validation rules
  • Improved the error handling
  • Improved file renaming and moving
  • Removed config and mime type mapping
  • Removed Test and Vendor files
  • Option name was renamed to nameCallback
  • Option importFrom was removed as importing is built in
  • Option s3 was replaced with transport
  • Option metaColumns had keys renamed
  • Options baseDir and uploadDir were replaced with tempDir, uploadDir and finalPath
  • Options maxNameLength and saveAsFilename were removed
  • View the updated documentation for help

Changelogs: Uploader v3.6

A new version of Uploader has been released, version 3.6. Please download the new tag or view the documentation. If you have any questions, be sure to send me an email or comment on this post. If you run into any problems, be sure to report an issue on the Github repository.

Version: 3.6
Tested On: PHP 5.3, CakePHP 2.0.5
Requires: PHP 5.2, CakePHP 2.0
Commit Hash: d1f2f0c253d4c132836049dee6c84422155fb05e
Changes:

  • Fixed PHP 5.4 strict errors
  • Fixed a bug where empty file uploads will still trigger validation
  • Added an allowEmpty option for Uploader::uploadAll()
  • Added width and height validation rules to FileValidationBehavior
  • Refactored Uploader::uploadAll() to accept an array of options instead of arguments (backwards compatible)
  • Refactored so that on/allowEmpty rules can be passed to FileValidationBehavior like regular validation rules
  • Required validation rule is now by default, allowEmpty true and on create
  • Replaced errors with exceptions
  • Allow empty extension validation to use all mime types [Issue #56]
  • Allow empty file uploads to continue when multiple uploads are used [Issue #62]
  • Use uploadDir in AttachmentBehavior::beforeDelete() if saveAsFilename is true [Issue #63]
  • Use cURL to grab the ext/mimetype for Uploader::importRemote() [Issue #55]
  • Grab image dimensions at the end of Uploader::upload() to work for all upload formats [Issue #60]

Changelogs: Uploader v3.5

A new version of Uploader has been released, version 3.5. Please download the new tag or view the documentation. If you have any questions, be sure to send me an email or comment on this post. If you run into any problems, be sure to report an issue on the Github repository.

Version: 3.5
Tested On: PHP 5.3, CakePHP 2.0.5
Requires: PHP 5.2, CakePHP 2
Commit Hash: b91bd81415a50f69d589a77d9dbe7a576e1c5744
Changes:

  • Added file overwrite settings for transform methods [Issue #50] (overwrite settings are set to false by default)
  • Fixed weirdness with append and prepend [Issue #46]
  • Fixed a bug with uppercase file extensions
  • Rewrote Uploader::crop() to maintain aspect ratio and fix wrong calculations [Issue #51]

Changelogs: Uploader v3.3

A new version of Uploader has been released, version 3.3. Please download the new tag or view the documentation. If you have any questions, be sure to send me an email or comment on this post. If you run into any problems, be sure to report an issue on the Github repository.

Version: 3.3
Tested On: PHP 5.3, CakePHP 2.0.5
Requires: PHP 5.2, CakePHP 2.0
Commit Hash: a7f98d51909a1ba74ca9cdd6a15366f19a383b8c
Changes:

  • Added a saveAsFilename option to AttachmentBehavior to save an upload without the relative path [Issue #41]
  • Added more mime type support [Issue #42]
  • Added mode orientation support to Uploader::resize()
  • Added tons more test cases
  • Fixed an undefined offset error when uploading without a model
  • Fixed a bug where a custom name wasn't being used in chained transforms
  • Refactored Uploader::resize() so that aspect and expand work in unison

Changelogs: Uploader v3.2

A new version of Uploader has been released, version 3.2. Please download the new tag or view the documentation. If you have any questions, be sure to send me an email or comment on this post. If you run into any problems, be sure to report an issue on the Github repository.

Version: 3.2
Tested On: PHP 5.3, CakePHP 2.0.5
Requires: PHP 5.2, CakePHP 2.0
Commit Hash: f061776a146919f3d5305bd9573c466eac24e2ee
Changes:

  • Fixed a Linux upload issue regarding multiple transforms
  • Fixed Uploader::addMimeType() to not overwrite existing values
  • Fixed Uploader::crop() when both height and width are equal
  • Fixed strict errors
  • Fixed issue with transforms not inheriting custom name [Issue #36]
  • Fixed a bug with multiple model uploading with AttachmentBehavior
  • Recursively delete files if transforming overwrites the original
  • Can now accept a model method for file name formatting [Issue #35]
  • Added an aspect setting to Uploader::resize() [Issue #40]
  • Added an allowEmpty setting to AttachmentBehavior to allow empty file uploads to continue [Issue #38]