Exemple #1
0
function asidoImg($arr)
{
    asido::driver('gd');
    $height = $arr['height'];
    $width = $arr['width'];
    $x = $arr['x'];
    $y = $arr['y'];
    // process
    $i1 = asido::image($_SERVER["DOCUMENT_ROOT"] . trim($arr['temp_uploadfile']), $_SERVER["DOCUMENT_ROOT"] . trim($arr['new_uploadfile']));
    // fit and add white frame
    if ($arr['thumb'] === true) {
        Asido::Crop($i1, $x, $y, $width, $height);
    } else {
        Asido::Frame($i1, $width, $height, Asido::Color(255, 255, 255));
    }
    // always convert to jpg
    Asido::convert($i1, 'image/jpg');
    $i1->Save(ASIDO_OVERWRITE_ENABLED);
    $data = array('photo' => $arr['new_uploadfile']);
    // echo $user_id;
    // delete old file
    return $data['photo'] . "|" . $width . "|" . $height;
}
Exemple #2
0
function asidoImg($arr)
{
    include 'asido/class.asido.php';
    asido::driver('gd');
    $height = $arr['height'];
    $width = $arr['width'];
    $x = $arr['x'];
    $y = $arr['y'];
    // process
    $i1 = asido::image($arr['temp_uploadfile'], $arr['new_uploadfile']);
    // fit and add white frame
    if ($arr['thumb'] === true) {
        Asido::Crop($i1, $x, $y, $width, $height);
    } else {
        Asido::Frame($i1, $width, $height, Asido::Color(255, 255, 255));
    }
    // always convert to jpg
    Asido::convert($i1, 'image/jpg');
    $i1->Save(ASIDO_OVERWRITE_ENABLED);
    $data = array('photo' => $arr['new_uploadfile']);
    // echo $user_id;
    // delete old file
    echo $data['photo'];
}
Exemple #3
0
*
* This example shows how to convert an image explicitly declaring the type of 
* the image disregarding the extension of the "result" image.
*
* @filesource
* @package Asido.Examples
* @subpackage Asido.Examples.Convert
*/
/////////////////////////////////////////////////////////////////////////////
/**
* Include the main Asido class
*/
include './../../class.asido.php';
/**
* Set the correct driver: this depends on your local environment
*/
asido::driver('gd');
/**
* Create an Asido_Image object and provide the name of the source
* image, and the name with which you want to save the file
*/
$i1 = asido::image('example.png', 'result_02.jpg');
/**
* Save the result as GIF nevertheless we set the result name to be a JPEG one
*/
Asido::convert($i1, 'image/gif');
/**
* Save the result
*/
$i1->save(ASIDO_OVERWRITE_ENABLED);
/////////////////////////////////////////////////////////////////////////////
function asidoImg($arr)
{
    include dirname(__FILE__) . '/../Util/asido/class.asido.php';
    asido::driver('gd');
    $height = $arr['height'];
    $width = $arr['width'];
    $x = $arr['x'];
    $y = $arr['y'];
    // process
    $i1 = asido::image($arr['temp_uploadfile'], $arr['new_uploadfile']);
    // fit and add white frame
    if ($arr['thumb'] === true) {
        Asido::Crop($i1, $x, $y, $width, $height);
    } else {
        // rotate the image if it is portrait
        // switch($arr['orientation'])
        // {
        // 	case 1: // nothing
        // 	break;
        // 	case 2: // horizontal flip
        // 	break;
        // 	case 3: // 180 rotate left
        // 		Asido::Rotate($i1,180);
        // 	break;
        // 	case 4: // vertical flip
        // 	break;
        // 	case 5: // vertical flip + 90 rotate right
        // 	break;
        // 	case 6: // 90 rotate right
        // 		Asido::Rotate($i1,90);
        // 	break;
        // 	case 7: // horizontal flip + 90 rotate right
        // 	break;
        // 	case 8:    // 90 rotate left
        // 		Asido::Rotate($i1,-90);
        // 	break;
        // }
        Asido::Frame($i1, $width, $height, Asido::Color($arr['canvasbg']['r'], $arr['canvasbg']['b'], $arr['canvasbg']['g']));
    }
    // always convert to jpg
    Asido::convert($i1, 'image/jpg');
    $i1->Save(ASIDO_OVERWRITE_ENABLED);
    $data = array('photo' => $arr['web_file']);
    // echo $user_id;
    // delete old file
    echo $data['photo'];
}