Comments (7)
StorageManager::adapter($data['PdfFile']['adapter'])->delete($data['PdfFile']['path']);
Calls the adapter directly - you have to make sure you build the correct path. If you used the same way to store images you won't even have any versions. You have to use the ImageStorage model. NOT the adapter directly. The adapter is a simple read/write Interface, it does not do the image processing magic, it just stores them. The model triggers events, look at the ImageStorage model and check Event/ImageProcessingListeiner.php for the actual implementation of image processing and deleting.
The readme.md also says to look at ImageProcessingListeiner.php and that you should use the model for storing images. Read the "Image Versioning" section of the readme.md.
If you extend or directly use the FileStorage model you don't even have to care of writing all the code yourself that is i the upper section of the readme.md, the model will do all the checking.
from cakephp-file-storage.
Closing this now because no additional feedback was provided.
from cakephp-file-storage.
Hi I am trying to delete as well with my versioning,
In my ProductImagesTable I extends ImageStorageTable
This is where I have my upload method based on your tutorial.
I tried to create a delete method that removes the FileStorage row hoping the ImageStorageTable would run the ImageProcessingListener to listen for the delete which would remove the files like the upload did but that didn't work.
Can you offer some advice thank you.
from cakephp-file-storage.
@artnos it is nearly impossible to understand the problem with the code without knowing the code. You need to come up with an easy and clear to reproduce scenario.
Please provide an unit test that demonstrates the problem.
from cakephp-file-storage.
I don't know how to unit test but I made a stackoverflow and detailing my enviroment
http://stackoverflow.com/questions/32209075/cakephp-3-filestorage-plugin-triggering-the-imageprocessinglistener-to-delete-ve
I hope this helps.
from cakephp-file-storage.
@artnos Please read about deleting data in CakePHP: http://book.cakephp.org/3.0/en/orm/deleting-data.html
Now you're doing it wrong.
from cakephp-file-storage.
ugh, thank you I changed my delete to, it works now
$entity = $this->get($fileStorageID);
$result = $this->delete($entity);
I knew about deleting this way i dont know why i choose the other way.
It doesn't remove the folders though, but that doesn't really matter. Thanks so much.
from cakephp-file-storage.
Related Issues (20)
- No versions of jpeg files HOT 4
- Keep a Change Log HOT 2
- Can't save file when creating related model HOT 2
- Upgrading from v1 to v2 HOT 7
- Tag current 2.0 version with next semver tag HOT 1
- How can one add to the list of supported adapter classes? HOT 5
- No image manipulation or correct url paths being returned HOT 2
- updating docs HOT 3
- Todo: Add migration guide from Cake 3 to 4 HOT 2
- updating docs
- Class could be found HOT 4
- Followed the guidelines in documentations server complaints 'Burzum\FileStorage\Event\LocalFileStorageListener' not found HOT 3
- Created a script to upload files to S3 - files uploaded but script throws error The listener `Burzum\FileStorage\Storage\Listener\LocalListener` doesn't allow the `\Gaufrette\Adapter\AwsS3` adapter class! Probably because it can't work with it HOT 4
- cakephp/cakephp 4.0.x dependency issue HOT 7
- Version 4.0 (complete rewrite) HOT 3
- Antipattern showcase
- Link in docs is broken
- Issues with upload for 1:1 HOT 1
- Issues installing via composer HOT 8
- Looking for a new maintainer
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cakephp-file-storage.