Using filters to process uploaded images
-
I have posted about this on the main website, but so far no reply.
Basically I am wanting to resize images after they have uploaded.
Following this post https://wordpress.org/support/topic/possible-to-use-uploaded-file-after-upload-is-success I have installed Code Snippets and created the following snippet just as a test to see if I can get that to work before addressing resizing images. Unfortunately the post went to private email so solution was never posted.
I am having the same problem in that images are uploaded but no log file is created. (I even tried creating an empty log file first)if (!function_exists('wfu_before_file_upload_handler')) { function wfu_before_file_upload_handler($file_path, $file_unique_id) { $_SESSION['wfu_tempfiles'][$file_unique_id] = $file_path; return $file_path; $message="TEST MESSAGE 1"; wfu_debug_log($message); } add_filter('wfu_before_file_upload', 'wfu_before_file_upload_handler', 10, 2); } if (!function_exists('wfu_after_file_upload_handler')) { function wfu_after_file_upload_handler($changable_data, $additional_data) { if ($additional_data['upload_result'] == 'success' && isset($_SESSION['wfu_tempfiles'][$file_unique_id]) && $_SESSION['wfu_tempfiles'][$file_unique_id] != '') { $file_contents = file_get_contents($_SESSION['wfu_tempfiles'][$file_unique_id]); $message="TEST MESSAGE 2"; wfu_debug_log($message); } return $changable_data; } add_filter('wfu_after_file_upload', 'wfu_after_file_upload_handler', 10, 2); }All I need to be able to do is grab the location of each uploaded file and pass it to some php code for resizing.
The topic ‘Using filters to process uploaded images’ is closed to new replies.