I'm using hook_node_presave()
to set values for fields that were left empty when a node is created/updated. Text fields are easy enough ($node->field_name['und'][0]['value'] = 'Default text'
), but image fields have got me stumped...
Image fields have lots of array values (e.g. fid, width, height, alt, etc.). I'm assuming there's a function I can call that'll create all the necessary values, but I can't seem to find it.
On top of all that, I have an external image URL that I'd like to programatically download and save to the image field. I'm using the Filefield Sources module to do this in the interface, but again, I need to know how to do this programatically instead.
Recent comments
OK i will try with a fresh install of Drupal up-gradation to Backdrop without any contributed module. Thanks for responding!
User login (second time) issue after upgrading from Drupal7 to Backdrop
Wow, brilliant!
New form creation weirdness
Ah, right you are. Thank you! I'd be nice if it were possible to do the same from the actual site though...
How to remove default image styles
You can remove the image style JSON files from the active configuration folder (under /files).
How to remove default image styles
Great spotting!! It's a form that is in an admin.inc; only specific roles that don't include the user can access it. However I have inspected the sources tab, and found the user.js is loaded...
New form creation weirdness