Drupal Save Profile Image Programmatically

When we use the Profile 2 module and need to save the profile image field (existing), we can use profile2 functions and achieve the task. Note down the Field needs to be updated. Load the profile. Add Image field to the loaded profile object Save the profile. function save_image_profile2($profile_id, $image_id){ // Load the profile objectcontinue reading

PHP Delete multiple files if name contains..

I wanted to delete thousands of thumbnails mixed with original images using php. There were no easy solutions available in Windows without extra tools. (Dint want command solution either) Here is the script i used to delete multiple files with names containing “word” in them. Note: We need a php server to run this script.