Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.
Please keep in mind:
- no problem, it easy.But how doDo a getimagesize and get the image width
? it is standart api function, or standart php function? do you have a sample? thanksDo a conditional for the target max size abd then inject the resize value.
if (isset($_POST['submit_url']))
{
list($width, $height, $type, $attr) = getimagesize($_POST['upload2']);
if($width>1200) $to_resize = 1000;
$api_upload->resize_width = $to_resize;
//set POST variables
$url = 'http://img.rebill.me/api';
$fields = array(
'key' => urlencode('reb_api'),
'upload' => $_POST['upload2'],
'format' => urlencode('txt')
);
//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);
if($width>1200) $to_resize = 1000;
$api_upload->resize_width = $to_resize;
list($width, $height, $type, $attr) = getimagesize($_POST['upload2']);
?>
<script>
alert(<?=$width;?>);
</script>
<?
if($width>1200) $to_resize = 1000;
$api_upload->resize_width = $to_resize;
<form NAME="stockForm" action="upload.php" method="post" enctype="multipart/form-data">
<input type="text" class="bginput" size="30" name="upload2" />
<input type="submit" class="button" name="submit_url" value="Send" style="width:70px" />
</form>
<?
if (isset($_POST['submit_url']))
{
list($width, $height, $type, $attr) = getimagesize($_POST['upload2']);
?>
<script>
alert(<?=$width;?>);
</script>
<?
if($width>1200) $to_resize = 1000;
$api_upload->resize_width = $to_resize;
//set POST variables
$url = 'http://img.rebill.me/api';
$fields = array(
'key' => urlencode('reb_api'),
'upload' => $_POST['upload2'],
'format' => urlencode('txt')
);
//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);
print"$result";
//close connection
curl_close($ch);
}
?>