Exemple #1
0
/**
 * mime_flash_store_preferences 
 * 
 * @param array $pFileHash Flash information
 * @access public
 * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
 */
function mime_flash_store_preferences(&$pFileHash)
{
    $ret = FALSE;
    if (@BitBase::verifyId($pFileHash['attachment_id'])) {
        list($pFileHash['preferences']['width'], $pFileHash['preferences']['height'], $type, $attr) = getimagesize(STORAGE_PKG_PATH . $pFileHash['upload']['dest_branch'] . $pFileHash['upload']['name']);
        // store width of video
        if (!empty($pFileHash['preferences']['width'])) {
            LibertyMime::storeAttachmentPreference($pFileHash['attachment_id'], 'width', $pFileHash['preferences']['width']);
        }
        // store height of video
        if (!empty($pFileHash['preferences']['height'])) {
            LibertyMime::storeAttachmentPreference($pFileHash['attachment_id'], 'height', $pFileHash['preferences']['height']);
        }
        $ret = TRUE;
    }
    return $ret;
}
Exemple #2
0
/**
 * mime_video_update
 *
 * @param array $pStoreRow
 * @access public
 * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
 */
function mime_video_update(&$pStoreRow, $pParams = NULL)
{
    $ret = FALSE;
    if (BitBase::verifyId($pStoreRow['attachment_id'])) {
        $pStoreRow['log'] = array();
        // set the correct pluign guid, even if we let default handle the store process
        $pStoreRow['attachment_plugin_guid'] = PLUGIN_MIME_GUID_VIDEO;
        // remove the entire directory
        $pStoreRow['unlink_dir'] = TRUE;
        // if storing works, we process the video
        if (!empty($pStoreRow['upload']) && ($ret = mime_default_update($pStoreRow))) {
            if (!mime_video_converter($pStoreRow)) {
                // if it all goes t**s up, we'll know why
                $pStoreRow['errors'] = $pStoreRow['log'];
                $ret = FALSE;
            }
        }
        // if there was no upload we'll process the file parameters
        if (empty($pStoreRow['upload']) && isset($pParams['meta']['aspect'])) {
            // set aspect NULL that it's removed from the database
            if (empty($pParams['meta']['aspect'])) {
                $pParams['meta']['aspect'] = NULL;
            }
            // we store the custom aspect ratio as a preference which we will use to override the original one
            if (!LibertyMime::storeAttachmentPreference($pStoreRow['attachment_id'], 'aspect', $pParams['meta']['aspect'])) {
                $log['store_meta'] = "There was a problem storing the preference in the database";
            }
            if (empty($log)) {
                $ret = TRUE;
            } else {
                $pStoreRow['errors'] = $log;
            }
        }
    }
    return $ret;
}