Coder Social home page Coder Social logo

Comments (7)

burzum avatar burzum commented on May 20, 2024

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.

burzum avatar burzum commented on May 20, 2024

Closing this now because no additional feedback was provided.

from cakephp-file-storage.

artnos avatar artnos commented on May 20, 2024

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.

burzum avatar burzum commented on May 20, 2024

@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.

artnos avatar artnos commented on May 20, 2024

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.

robertpustulka avatar robertpustulka commented on May 20, 2024

@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.

artnos avatar artnos commented on May 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.