I've image name and i would like to save it to my desired folder.
How to achieve this ? Any help would be appreciated.
Update
I am trying to implementing Image Crop function at frontend.
Like User will get option to get crop image option while they upload image.
For that I'm using a example. Check Here
Its working for Core PHP.
I am trying to implementing this code in my controller.
$data = $this->request->getParam('group_image');
list($type, $data) = explode(';', $data);
list(, $data) = explode(',', $data);
$data = base64_decode($data);
echo $imageName = time().'.png'; exit;
Here $imageName
returns Image Name now i want to save this image under Pub/Media.
PS : PHP they have used file_put_contents('upload/'.$imageName, $data);
IF i use file_put_contents
its working but due to i am doing this in Module MEQP2 standard not allow me to use this function I've to implement this in Magento way.
Question : What is Best Magento way to achieve this ?