Exemplo n.º 1
0
function process_uploaded_file($file_name, $file_path, $allow_existing_file = false)
{
    include "AMP/System/Upload.inc.php";
    include "AMP/Content/Image/Resize.inc.php";
    $upLoader = new AMPSystem_Upload($file_name);
    $image_path = AMP_CONTENT_URL_IMAGES . AMP_IMAGE_CLASS_ORIGINAL;
    $folder_okay = true;
    $is_image = false;
    if (function_exists('mime_content_type')) {
        $mime_type = mime_content_type($file_path);
        if (substr($mime_type, 0, 5) == 'image') {
            $is_image = true;
        }
    } else {
        if (isset($_REQUEST['doctype']) && $_REQUEST['doctype'] == 'img') {
            $is_image = true;
        }
    }
    if ($is_image && !$upLoader->setFolder($image_path)) {
        $folder_okay = false;
    }
    if ($folder_okay && $upLoader->execute($file_path, $allow_existing_file)) {
        $new_file_name = basename($upLoader->getTargetPath());
        $result_message = "<BR><font face='arial' size=2>File was successfully uploaded.<br>" . "<br><b>Filename:</b>" . $new_file_name . "</font>";
        //"</a></font></b><br><br><br><br><br><br><br><br>\n"
        //.return_filename($new_file_name);
        if ($is_image) {
            $reSizer = new ContentImage_Resize();
            require_once 'AMP/Content/Image.inc.php';
            if ($reSizer->setImageFile($upLoader->getTargetPath()) && $reSizer->execute()) {
                $imageRef = new Content_Image($file_name);
                $result_message = '<image src="' . $imageRef->getURL(AMP_IMAGE_CLASS_THUMB) . '" align="left" border="0">' . $result_message;
            }
        }
    } else {
        $result_message = "File Upload Failed<BR>\n" . join('<BR>', $upLoader->getErrors());
    }
    return $result_message;
}
Exemplo n.º 2
0
 function _makeThumb(&$source, $column_name)
 {
     require_once 'AMP/Content/Image.inc.php';
     $img = new Content_Image($source->getName());
     return $this->_HTML_link($img->getURL(AMP_IMAGE_CLASS_ORIGINAL), $this->_HTML_image(AMP_image_url($source->getName(), AMP_IMAGE_CLASS_THUMB), $this->_thumb_attr), array('target' => 'blank'));
 }
Exemplo n.º 3
0
<?php

$image_name = AMP_find_banner_image();
if ($image_name) {
    require_once 'AMP/Content/Image.inc.php';
    $renderer = AMP_get_renderer();
    $imageRef = new Content_Image($image_name);
    $image_url = $imageRef->getURL(AMP_IMAGE_CLASS_ORIGINAL);
    print $renderer->image($image_url, array('class' => 'template_image'));
}