Created
October 15, 2013 17:24
-
-
Save jcnevado/6995260 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function noticia_grid_cropandresize() | |
{ | |
$url = variable_get('elementos_app', 0) . '/index.php/cropandresize/grid'; | |
$post = array(); | |
$post['apikey'] = '590ee43e919b1f4baa2125a424f03cd160ff8901'; | |
$post['base_name']= $_POST['base_name']; | |
$post['fid']= $_POST['fid']; | |
$post['fid_path']= $_POST['fid_path']; | |
$post['ext']= $_POST['ext']; | |
$post['left']= $_POST['left']; | |
$post['top']= $_POST['top']; | |
$post['resizeHeight']= $_POST['resizeHeight']; | |
$post['resizeWidth']= $_POST['resizeWidth']; | |
$post['thumbHeight']= $_POST['thumbHeight']; | |
$post['thumbWidth']= $_POST['thumbWidth']; | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_USERAGENT, 'MD3'); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $post); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
$result = curl_exec($ch); | |
curl_close ($ch); | |
$res = json_decode($result); | |
if ( $res->status == 201 ){ | |
$message = 'Error en el corte. La imagen debe ser mayor a '. $post['thumbWidth'] .' x ' . $post['thumbHeight']; | |
} | |
elseif ( $res->status == 200 ) { | |
$message = 'El corte de la imagen se realizó exitosamente.'; | |
} | |
else{ | |
$message = 'Error al realizar el corte de la imagen'; | |
} | |
echo $message; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment