Example #1
0
##########################################################################################################################################
if (isset($_POST['arquivo']) && isset($_POST['x1']) && isset($_POST['y1']) && strlen($_POST['arquivo']) > 5) {
    # import class to form validation
    $this->vLoadClass($this->vconf['path'], "/vActions.phar/class.images.php");
    # start new class
    $ap = new vtxImages();
    // The file
    $fileThumb = $_POST['arquivo'];
    $filename = "{$destine}{$enterID}/{$_POST['arquivo']}";
    $fileFinal = "{$destine}{$enterID}/{$fileThumb}";
    // Set a maximum height and width
    $width = 140;
    $height = 140;
    // Resample
    $image_p = imagecreatetruecolor($width, $height);
    $image = $ap->getImageInfo($filename);
    imagecopyresampled($image_p, $image['create'], 0, 0, $_POST['x1'], $_POST['y1'], $width, $height, $_POST['w'], $_POST['h']);
    // Output
    imagejpeg($image_p, $fileFinal, 80);
    // clear temp file
    imagedestroy($image_p);
    # finish
    exit($this->vForceStop("1| Texto publicado com sucesso"));
}
##########################################################################################################################################
## form upload foto
##########################################################################################################################################
if (isset($_FILES['userfile']['tmp_name']) && is_uploaded_file($_FILES['userfile']['tmp_name']) && isset($_POST['userdir'])) {
    $uptype = $_FILES['userfile']['type'];
    # check is valid file
    if (!in_array($uptype, $this->vconf['uppics'])) {