Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I wasn't able to select nodes using EntityFieldQuery when I only knew the file ID of the original file, like so:
$query->entityCondition('entity_type', 'node')
->entityCondition('bundle', 'photo')
->propertyCondition('status', NODE_PUBLISHED)
->fieldCondition('field_photo_file', 'fid', $file->fid);
We need this because we are using the file ID in the URL. Imagefield_crop creates a new file each time a node was saved, so the URL became invalid. I created a patch that adds orig_fid attribute to the field, so you can use this in a condition:
fieldCondition('field_photo_file', 'orig_fid', $file->fid);
I thought it could be useful to others.
Comment | File | Size | Author |
---|---|---|---|
imagefield_crop_orig_fid.patch | 2.76 KB | bceyssens |
Comments
Comment #1
bceyssensComment #2
bceyssensComment #3
ram4nd CreditAttribution: ram4nd as a volunteer commented