Any ideas how I may do that from the Admin panel. I've got the image in base64 but just trying to figure out how I can now upload it to the media folder.
Pointing me to code in magento that shows a rough example is totally an acceptable answer
There is no magento things required for that you can do with file_put_content
Here output file will be file you created with fopen() , so create file with fopen and put your code with file_put_content
If you want to use file_put_content with magento way then
add dependency in your class for
and with $fileDriver object you can call filePutContents Method like below
If my answer solves your concern then hit kudos button and mark as accepted
Lets 's say you have base64_encoded image string in a variable called $imageString
$imageString = "your_base64_encoded_image";
First you need to decode by using base64_decode function and then you need to give full path along with filename in file_put_contents functions.
Below is the code for the same :
$imageString = "your_base64_encoded_image"; file_put_contents('../pub/media/MyFile.jpg', base64_decode($imageString));
If you just wanted to try first this - create a php file in root folder of magento 2
Then put above code in it - then run via browser and check
It will generate image file for the same
Hope it helps !