PHP code example of teaocha / sonata-admin-image-panel
1. Go to this page and download the library: Download teaocha/sonata-admin-image-panel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
teaocha / sonata-admin-image-panel example snippets
use Teaocha\SonataAdminImagePanelBundle\Request\RequestHandlerInterface;
use Teaocha\SonataAdminImagePanelBundle\Request\RequestResult;
class ImagePanelRequestHandler implements RequestHandlerInterface
{
public function imageUpload($imageData, $contentType){
//Do something with the image data
$requestResult = new RequestResult()
$requestResult->setPreviewUrl($url);
$requestResult->setId($id);
return $requestResult;
}
public function imageUrlUpload($imageUrl){
//Do something with the url
$requestResult = new RequestResult()
$requestResult->setPreviewUrl($url);
$requestResult->setId($id);
return $requestResult;
}
public function deleteImage($id){
//Delete the image
}
public function listImages(){
//Generate an array of RequestResult objects
return $results;
}
}