Comments (8)
Hi.
It's needed this. I'm detecting some issues:
1.- When I create a new item and I upload a image, automatically the file is upload to "[defined path]" and "[defined path]/thumbnails" folder with a hash. And I have no original image defined in the config.
2.- If I crop the image and continue, the cropped image is uploaded automatically to "[defined path]/cropped" and "[defined path]/cropped/thumbnails" folder with a hash, wich is different to full image hash.
3.- If I flush the new item, all it's ok. The files are there. But in the database I only have the cropped filename with the step 2 hash.
4.- If I cancel the new item, the images have been uploaded anyway.
Then, I can't imagine how to handle the images deletion. My knowledge of symfony is limited, but I'm trying to handle this and I'm frustrated.
I hope you will deal with this soon. I don't know how to resolve it :-(
from comurimagebundle.
Hi @Tersoal
I have some thoughts about this issue.
First, you can save original file name in another field if you want to delete it when your entity is removed (be careful, you will no longer see this image in "already uploaded" images selection). To do this, you can pass a parameter to your field : https://github.com/comur/ComurImageBundle#saveoriginal-optional
Then in your entity you need to use http://doctrine-orm.readthedocs.org/en/latest/reference/events.html#preremove function to delete images uploaded / cropped by this entity.
Tell me if you are able to achieve that.
from comurimagebundle.
Thanks!
Let me see...
from comurimagebundle.
Well, it does not work.
I have defined my image field with 'saveOriginal' => false (or you can delete this as it's by default). The image file is upload by ajax to the server anyway, just when the image is selected to upload.
Preremove lyfecycle callback does not work because the defined field isn't a file, but string instead.
I'm updating my form, entity and controller to delete files. I'll put here, and it should be included in the doc for reference to new users.
from comurimagebundle.
Send me your code and i will show you how to do it. I have to include a real example in the project
from comurimagebundle.
I'll put here. Is up to you how include it in the docs.
I see other problems that I have to confirm in my tests.
from comurimagebundle.
Hi.
I have resolved the old image files deletion with a service. The problem is that it must be done for all entities that have a comur image field, and I have tried to do in the bundle, but I don't know how identify the image fields in classmetada. My knowledge of symfony is not sufficient.
-
Entity and form field: as doc says, but originalImage is mandatory for deleting uploaded image (I don't know why does occur it if I set the originalimage to false).
-
Create service definition:
acme.subscriber.hello:
class: Acme\HelloBundle\Service\HelloSubscriber
tags:
- {name: doctrine.event_subscriber }
arguments: [%comur_image.cropped_image_dir%, %comur_image.thumbs_dir%, "@service_container", %comur_image.web_dirname%, %comur_image.gallery_dir%] -
Create service: all reference to tempNewOriginalImage must be commented if you don't want to delete the original image.
from comurimagebundle.
Hi,
Thanks for this great job, I will take some time to check it.
from comurimagebundle.
Related Issues (20)
- Remove dependency on dev/master of jms/translation-bundle HOT 1
- JSON Parse Symfony 3 HOT 1
- Does the bundle support ajax? drag and drop feature?
- Unexpected token U in JSON at position 66 HOT 1
- data.result.image_upload_file is undefined in comur.imagelibrary.js:67:1 HOT 1
- How to upload a simple Image widget with ComurImageBundle? HOT 1
- unable to upload on php7.1 due to notice HOT 3
- Support of Symfony 4.0 HOT 3
- how upload image to database any help please!! HOT 1
- Nothing happens when selecting an image HOT 1
- Can we have a new release? HOT 1
- Add alt text for image
- Symfony flex support HOT 3
- Support Symfony 5.x HOT 13
- Remove dependency on jms/translation-bundle
- Remove dependency on deprecated module twig/extensions
- composer command not installing ComurImageBundle HOT 1
- Set input class HOT 1
- conflict with requirements symfony form (composer) HOT 1
- Amélioration du module HOT 4
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 comurimagebundle.