[Solved] How to save binary images to wordpress upload directory

Many times, when we use an editor for example, Summernote, and we upload a media then it returns the html with biary images. If the images are large in size, then binary data also exceedes, so the content cannot be loaded in the wp-admin and hangs the browser, so we need to save binary images to wp upload directory.

To save binary images, we need to use DOM library, but we have to also use some important flags to save images flawlessly. Using this function save_binary_images, you can save all the binary images present in the content. You may also provide prefix to the name of images, just by providing value of $image_prefix. You can see the below code and just copy and paste to save binary images to wp upload directory : Keep on reading