Ansel generates img:path img:url from timestamp not filename
It looks like the img:path and img:url are generated using either the modified or uploaded timestamp instead of the filename or basename.
I was able to track it down to the Service/AnselImages/ImagesTag.php
setVariablesFromRecord where it’s using the
$record for most all variables except the
url where it uses the raw
$file. I’ve modified it to the following (which isn’t ideal as there’s no
Related to this issue, it looks like if you delete an entry that contains an Ansel -> Assets field, if you use the same image on another entry, that image is also deleted as Ansel calls
Service/AnselImages/DeleteRow.php in the
delete() method. Assets reuses images so it shouldn’t delete the source image when removing the Ansel image.
Commenting out that sourceRouter delete call seems to fix it deleting the image on the other entries.
June 19, 2017, 11:06 am
Hi Jace, I cannot duplicate the issue where
url are incorrect. The
$file variable is not raw, it’s a class with information about the actual file so it should be right. I cannot fathom how it would not be right.
Ansel will always delete manipulated images, but never original source images. This comes down to the distinction between the “Upload Directory” and the “Save Directory”. As described in the documentation, and the instructions when setting up an Ansel field type:
The upload directory is where raw source images (un-cropped and unmodified) are uploaded and stored. Images in this directory or uploaded to this directory will always be visible when selecting/uploading images to the field.
The save directory is where Ansel will save and store the captured images. Images are named with the Ansel image ID and timestamp. Images in this directory are transient — they can come and go as the fields are updated and images are added and removed. The save directory is not meant to be a user-serviceable directory and is not seen by the user when adding/uploading images to the Ansel field.
It is strongly recommended that you not use the same directory for both Upload and Save. Best practice is to create a separate directory for Ansel to save images to.
An Ansel field row instance expects to be the sole owner of the image it creates from the source image. As such, when the image changes, is re-cropped, or if its containing element/entry/whatever is deleted, the manipulated image (in the save directory) will be deleted.
June 21, 2017, 11:00 am
The issue only happens when there are multiple Ansel rows for different Channel Entries that reference the same
file_id like so: https://www.dropbox.com/s/iuclu8kcy87370q/file_id.png?dl=0
setVariablesFromRecord() method in the
ansel/Service/AnselImages/ImagesTag.php uses either
$originalSource for most all of the return vars except
location_field. Shouldn’t the
url use the
$record object instead of the original
Here’s a better explanation (hopefully): https://www.dropbox.com/s/fxtg8unwf5it0cz/ansel-record-issue.png?dl=0
June 22, 2017, 7:08 am
Ahh, well, I’ve discovered the issue then.
file_id should be unique per row. There should never be duplicate
file_ids. As I mentioned, a row expects to own the image it generates, per our prior conversations. In fact, I’d be willing to bet much money you were using Simple Cloner, which has duplicated rows, causing the same
file_id to be used in multiple rows.
file_id refers to the image Ansel generates uniquely for that row (
original_file_id would be the source image you uploaded/selected for that row).
So that also helps me understand images going missing in other places when you edit one somewhere else. Any time you delete an entry or a row, or even just modify the crop, the generated image for that row is deleted and a new one is generated.
June 22, 2017, 9:06 am
Log In or Register to Comment
Your account with the old support system does not carry over to the new support system. The new system is all tied together and connected with your account for purchasing and licenses. If you have a license, you have an account and you can log in with that email address and password. If you have not set a new password yet, you can do so with the forgot password link. Very sorry for any inconvenience.