Closed hervehobbes closed 11 years ago
1) That's more of a configuration issue. The Uploader shouldn't catch try and catch all scenarios where a misconfiguration happens.
2) Not sure I follow, can I see your model code?
1) The documentation should talk about it 2) just this
public $actsAs = array(
'Ordered',
'Translate' => array(
'title' => 'titleTranslation',
'content' => 'contentTranslation',
),
'Uploader.Attachment' => array(
'file' => array(
'nameCallback' => '',
'append' => '',
'prepend' => 'slides-',
'tempDir' => TMP,
'uploadDir' => 'medias/',
'transportDir' => '',
'finalPath' => '',
'dbColumn' => '',
'metaColumns' => array(),
'defaultPath' => '',
'overwrite' => false,
'stopSave' => true,
'allowEmpty' => true, fichier ?
'transforms' => array(
array(
'method' => 'exif',
'self' => true
),
'imageSmall' => array(
'nameCallback' => 'transformNameCallback',
'prepend' => 'small-',
'method' => 'resize',
'expand' => false,
'overwrite' => true,
'self' => false,
'width' => 120,
'height' => 90
),
'imageMedium' => array(
'nameCallback' => 'transformNameCallback',
'prepend' => 'medium-',
'method' => 'resize',
'expand' => false,
'width' => 412,
'height' => 355,
'aspect' => true
)
),
'transport' => array(),
'curl' => array()
)
)
);
public function transformNameCallback($name, $file) {
return $this->getUploadedFile()->name();
}
I just tested with your exact settings and everything worked fine. A few things however:
uploadDir
needs to be an absolute pathI am having the same issue as described in initial comment regarding the name callback...
The 'original' image is deleted AOK but the 'versions' remain...
Name callbacks have nothing to do with deletion, so that is irrelevant. Throw a debug() in the deleteFiles()
method to see if the database record has the correct columns and those columns are being referenced for deletion.
Have changed my configuration to 'standard' and everything is AOK - must have just been me being dumb. Cheers!
Hello,
Two things : 1) The deletion does not work at all if the uploadDir property is not finisihed by a / 2) When you use a nameCallback and have, let say 2 formats, on deletion just the main picture/file is removed, not the two others (for example medium and small).
Bye