Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Bloqs not deleting Ansel-generated images properly

Status Resolved
Add-on / Version Bloqs 3.1.4
Severity
EE Version 3.5.10

DSite

Jul 21, 2017

Congrats on taking over development for Bloqs! I’m really loving the module and I look forward to seeing what you do with it.

I’m writing because I recently noticed an issue when I use Bloqs with Ansel.

I’m using Bloqs 3.1.4 with EE 3.5.10 and Ansel 2.0.6 (the latest versions of all three).

In a clean install of EE, I have created a channel that has a Bloqs field with an Ansel atom.

When I add a new Ansel block, add an image, and save the entry, it creates the appropriate Ansel image. This works as expected.

When I change the crop on that image and save the entry, it deletes the old Ansel image and creates a new image for the new crop. This works as expected.

If I remove the image within the Ansel atom, it deletes the Ansel image from the save directory. This works as expected.

When I remove the Ansel block and save the entry, it should delete the Ansel image from the save directory. But it does not.

Likewise, when I remove an entry with an Ansel block, it should delete the Ansel image from the save directory. But it does not.

I think this is a Bloqs issue, because when I do all of the above with a Grid field, it works properly.

I’m using this combination on an image-heavy site, and I worry that my Ansel save folder will become unnecessarily bloated with images that are no longer needed by my entries.

I have two requests:
1. Could you fix Bloqs so that it removes the appropriate Ansel image when a block containing an Ansel atom is removed or when an entry containing a block with an Ansel atom is removed?
2. Is there a query I could use to find orphaned Ansel images that are no longer associated with an entry? (I’ve been using Bloqs and Ansel together for a few months and it would be nice to clean up my save folders and save some disk space.)

Thanks for your time. Please let me know if there is anything I can do clarify my issue or to help you troubleshoot this.

 

 

#1

BoldMinded (Brian)

Thanks for the kind words and for purchasing Bloqs.

I’m been talking to TJ at BuzzingPixel about this and I’m going to try to give him the method calls he needs to do the cleanup in Ansel. Deleting the data shouldn’t be Bloq’s responsibility, but it should be able to inform its fields when it should delete, which is what I’ll work on adding. It could be a few days before I have something added, plus TJ would need to add something to Ansel itself.

#2

DSite

Thanks for the quick response, Brian. TJ’s great to work with, and I’m sure the two of you will get it figured out.

#3

BoldMinded (Brian)

I made some updates and sent a build to TJ to test. When I get the go ahead from him I’ll send you a new build. It may also require a new Ansel build too.

#4

BoldMinded (Brian)

Both a new version of Bloqs and Ansel are out that should fix this issue.

#5

DSite

Thanks for working with TJ to fix this. I’ve installed both updates, and I have good news and bad news.

The good news is that the updates fixed one scenario: when I delete an Ansel block within an entry, it deletes the Ansel-generated image.

The bad news is that it looks as though the other scenario is still not working the way it should: when I delete an entry that contains an Ansel block, it does not delete the Ansel-generated image. I’ve tested this with a straight Ansel field, and deleting an entry does delete the Ansel-generated image. So it still seems as though this behavior is Bloqs-specific.

Thanks again for your time and for working to get this straightened out.

#6

BoldMinded (Brian)

Thanks for pointing this out. Since deleting a Bloqs field is not a common use case, this is going to be a lower priority for me. Generally people aren’t deleting Bloqs fields after they’ve created a lot of content with it.

#7

DSite

My apologies if I did not explain myself clearly. I agree that deleting the field completely is an unusual use case. But the scenario I tried to describe is much more common. Let me try to spell it out a bit more….

  1. I have a channel that has a Bloqs field and an Ansel atom.
  2. I create an entry and create an Ansel block within the Bloqs field.
  3. Ansel generates a unique image for that use.
  4. I decide that I need to remove the entry for some reason, so I click on the checkbox in the Entry Manager, select Remove, and click Submit.
  5. I would expect that removing the entry entirely would also delete the Ansel-generated image, but it does not.

When I remove an entry that has an image in a standard Ansel field, the Ansel-generated image is deleted along with the entry.

Does that make more sense?

#8

BoldMinded (Brian)

Sorry, I read your previous post and totally changed what you said in my head when I responded.

I still feel like this is Ansel’s responsibility to clean up its data. Bloqs shouldn’t have to manage cleaning up data from other add-ons when an entry is deleted. It would be a nightmare to try and maintain all of that code for other people’s add-ons.

There is a hook that Ansel, and any other add-on, can use to do this:

after_channel_entry_delete(ChannelEntry $channelEntry)
#9

BoldMinded (Brian)

I talked to TJ again, and while this is Ansel’s responsibility to clean up after itself, Bloqs isn’t telling Ansel when to do so. I’ll make a small change in Bloqs which should then trigger Ansel to do its thing. I’ll get you a new build sometime this week.

#10

DSite

Thanks. I know that getting add-ons to work together requires extra work and can often be a little hazy regarding responsibility. I appreciate your willingness to work with TJ on this.

#11

BoldMinded (Brian)

This should be fixed with the latest version of Bloqs and Ansel.

Login to reply