Hi, more of a suggestion here.
When we use the single picture uploader, the image does not delete when we delete the post entry.
For example, if I create a blog post with a picture uploader. I am able to delete the Post and the image stays in the directory. Given that I wont need that image anymore, shouldn't the image delete as well.
I can delete the image first and then the Post second and all is good, but would seem to make more sense to delete image if Post is deleted too.
Also, when we delete a Post and Image, the pic directory remains. If you had a blog with many posts that you create and delete, then we would eventually end up with a lot of empty picture directories.
If there is a logic to this I have missed, please let me know.
thanks
Picture Uploader
4 years ago
4 years ago
#1
4 years ago
#2
Hello,
You would have to have separate functions(methods) to delete the various items.
I think I would have all pictures in an image folder under the main module.
image/
Then have a sub-category for image size
image/sm
image/med
image/lg
This seems more easy to manage.
They are 2 different deletes, that is why you would need a separate delete method
To delete the image then create a function to get the image from the database and delete it.
You call the first method to delete the post and then call the method to delete the image.
Also, when we delete a Post and Image, the pic directory remains. If you had a blog with many posts that you create and delete, then we would eventually end up with a lot of empty picture directories.
For this I would have to see how you are create your image structure.
Dan
You would have to have separate functions(methods) to delete the various items.
I think I would have all pictures in an image folder under the main module.
image/
Then have a sub-category for image size
image/sm
image/med
image/lg
This seems more easy to manage.
They are 2 different deletes, that is why you would need a separate delete method
To delete the image then create a function to get the image from the database and delete it.
You call the first method to delete the post and then call the method to delete the image.
Also, when we delete a Post and Image, the pic directory remains. If you had a blog with many posts that you create and delete, then we would eventually end up with a lot of empty picture directories.
For this I would have to see how you are create your image structure.
Dan
4 years ago
#3
Hi John,
This was a known issue I raised a while back. And thought DC had addressed it when he added pictures to the same module and choice to have them put in the public folder.
I'll look at the code once more and post a solution when I'm back on front of the computer. From memory it was a simple fix.
Cheers,
Simon
This was a known issue I raised a while back. And thought DC had addressed it when he added pictures to the same module and choice to have them put in the public folder.
I'll look at the code once more and post a solution when I'm back on front of the computer. From memory it was a simple fix.
Cheers,
Simon
4 years ago
#4
Thanks for the comments.
I have now created the code myself so I can have a Large, Medium, Small image which I have added to the upload and ditch methods.
However, I do agree that one directory for all Post images (large, medium, small) within the module would be easier to manage.
Hope you are all well and happy.
Best
I have now created the code myself so I can have a Large, Medium, Small image which I have added to the upload and ditch methods.
However, I do agree that one directory for all Post images (large, medium, small) within the module would be easier to manage.
Hope you are all well and happy.
Best
4 years ago
#5
It's one for the ol' to do list. Hopefully it won't be long.
4 years ago
#6
By the way, having thought about this for a solid half hour I would agree it's fairly urgent. So, I really will do my best to get that nailed as soon as I can.
4 years ago
#7
Here is a quick solution to removing the remnant single picture uploader directories. Modify your module to look like this or wait for DC to modify the Desktop app's donor code for submit_delete() and ditch_picture() methods.
Modified submit_delete() method for a module called 'users' which has had a single picture uploader added:
Then change ditch_picture() donor code to look like this:
Hope the above makes sense.
Modified submit_delete() method for a module called 'users' which has had a single picture uploader added:
Then change ditch_picture() donor code to look like this:
Hope the above makes sense.
4 years ago
#8
Many thanks,
works perfectly.
works perfectly.