CodeSleeve/stapler — pull request #87 by Grafikart (2014-09-01 16:28:10+00:00)
Title: Allow invalid url

This PR needs some explanation.

## allow_invalid_url option

I wanted to manage attachment like wordpress does it so I set url doing so :

'url' => '/uploads/attachments/' . date('Y') . '/' . date('m') . '/:style.:filename',

I got an exception cause this url does not contain any :id / :hash so I chose to add a new option for developper willing to take the risk to break things **allow_invalid_url**

## FileSystem Storage Issue

Your filesystem storage emptyDirectory on file removal. This is a problem when you plan to have multiple images in the same folder so I tweaked it a bit. My method works like this :

- Delete the image
- Check if the directory containing the image is empty
- If it is empty remove the directory and check if the parent directory is empty too (recursively deleting every parent empty directory)

Do not hesitate to tell me if something is wrong with my ideas I can still do some edits.