milesj / uploader

[Deprecated] A CakePHP plugin for file uploading and validating.
MIT License
193 stars 73 forks source link

Can not delete Transforming image #181

Closed hemedani closed 10 years ago

hemedani commented 10 years ago

when i deleting record just delete the original file and other files is still on the own dir public $actsAs = array( 'Uploader.Attachment' => array( 'news' => array( 'nameCallback' => 'formatName', 'tempDir' => TMP, 'uploadDir' => 'img/uploads/news/original/', 'overwrite' => true, 'transforms' => array( 'imageSmall' => array( 'class' => 'crop', 'nameCallback' => 'transformNameCallback', 'uploadDir' => 'img/uploads/news/small/', 'overwrite' => true, 'self' => false, 'width' => 500, 'height' => 500 ), 'imageMedium' => array( 'class' => 'resize', 'nameCallback' => 'transformNameCallback', 'uploadDir' => 'img/uploads/news/medium/', 'width' => 800, 'height' => 600, ) )

            )
        )
    );
milesj commented 10 years ago

Are the transformed file paths being saved to the database? What version of Cake and the Uploader?

hemedani commented 10 years ago

no they don't save in the database cakephp 2.4.9 Uploader v4.4.0 there are no way to deleting file without saving record in the database ??!!

milesj commented 10 years ago

All the paths need to be saved into the database, how else would we know where to delete the file? Add a column for the original file path, and a column for each transform.

hemedani commented 10 years ago

tanks a lot each transform has a 'dbColumn' ???

milesj commented 10 years ago

The key in the transform array is the name of the database column. But there is also a dbColumn field too. Either or should work.

hemedani commented 10 years ago

tanks