aladdin
Chevereto Member
Hi, can you help me? When i upload images from my compyter, filename in chevereto - changes. But when i upload from URl, imagename in not changes.
From Comp
From URL
Can i change imagename when upload from url?
From Comp
PHP:
list($width, $height, $type, $attr) = getimagesize($_FILES['upload']['tmp_name'][$i]);
//set POST variables
$url = 'http://xxxxxxxxxxx/api';
$fields = array(
'key' => urlencode('xxxxxx_api'),
'upload' => base64_encode(file_get_contents($_FILES['upload']['tmp_name'][$i])),
'format' => urlencode('txt')
);
if($width>1920) $fields['resize_width'] = 1920;
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, sizeof($fields));
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 240);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect: '));
//execute post
$result = curl_exec($ch);
From URL
PHP:
list($width, $height, $type, $attr) = getimagesize($urls[$i]);
//set POST variables
$url = 'http://xxxxxxxxxxx/api';
$fields = array(
'key' => urlencode('xxxxxx_api'),
'upload' => $urls[$i],
'format' => urlencode('txt')
);
if($width>1920) $fields['resize_width'] = 1920;
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, sizeof($fields));
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 240);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect: '));
//execute post
$result = curl_exec($ch);
Can i change imagename when upload from url?