コード例 #1
0
ファイル: upload_inc.php プロジェクト: bitweaver/fisheye
/**
 * fisheye_store_upload
 */
function fisheye_store_upload(&$pFileHash, $pImageData = array(), $pAutoRotate = TRUE)
{
    global $gBitSystem, $gFisheyeUploads;
    $ret = array();
    // verifyMimeType to make sure we are working with the proper file type assumptions
    $pFileHash['type'] = $gBitSystem->verifyMimeType($pFileHash['tmp_name']);
    if (!empty($pFileHash) && $pFileHash['size'] > 0 && is_file($pFileHash['tmp_name']) && fisheye_verify_upload_item($pFileHash)) {
        // make a copy for each image we need to store
        $image = new FisheyeImage();
        // Store/Update the image
        $pImageData['_files_override'] = array($pFileHash);
        $pImageData['process_storage'] = STORAGE_IMAGE;
        $pImageData['purge_from_galleries'] = TRUE;
        // store the image
        if (!$image->store($pImageData)) {
            $ret = $image->mErrors;
        } else {
            $image->load();
            // play with image some more if user has requested it
            if ($pAutoRotate) {
                $image->rotateImage('auto');
            }
            $image->addToGalleries($_REQUEST['gallery_additions']);
            $gFisheyeUploads[] = $image;
        }
        // when we're using xupload, we need to remove temp files manually
        @unlink($pFileHash['tmp_name']);
    }
    return $ret;
}