本文整理匯總了PHP中Video::setMimeType方法的典型用法代碼示例。如果您正苦於以下問題:PHP Video::setMimeType方法的具體用法?PHP Video::setMimeType怎麽用?PHP Video::setMimeType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Video
的用法示例。
在下文中一共展示了Video::setMimeType方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: unlink
$prefix = "video/{$video->getGUID()}/";
// if previous video, delete it
if ($new_video == false) {
$videoname = $video->getFilenameOnFilestore();
if (file_exists($videoname)) {
unlink($videoname);
}
// use same videoname on the disk - ensures thumbnails are overwritten
$videostorename = $video->getFilename();
$videostorename = elgg_substr($videostorename, elgg_strlen($prefix));
} else {
$videostorename = elgg_strtolower($_FILES['upload']['name']);
}
$video->setFilename($prefix . $videostorename);
$mime_type = ElggFile::detectMimeType($_FILES['upload']['tmp_name'], $_FILES['upload']['type']);
$video->setMimeType($mime_type);
$video->originalvideoname = $_FILES['upload']['name'];
$video->simpletype = 'video';
// Open the video to guarantee the directory exists
$video->open("write");
$video->close();
move_uploaded_file($_FILES['upload']['tmp_name'], $video->getFilenameOnFilestore());
// Change the directory mode
chmod($video->getFileDirectory(), 0775);
$guid = $video->save();
}
// video saved so clear sticky form
elgg_clear_sticky_form('video');
// handle results differently for new videos and video updates
if ($new_video) {
if ($guid) {
示例2: parseVideo
public function parseVideo($videoObject)
{
$video = new Video();
$video->setFileId($videoObject->file_id);
$video->setWidth($videoObject->width);
$video->setHeight($videoObject->height);
$video->setDuration($videoObject->duration);
if (property_exists($videoObject, 'thumb')) {
$video->setThumb($this->parsePhotoSize($videoObject->thumb));
}
if (property_exists($videoObject, 'mime_type')) {
$video->setMimeType($videoObject->mime_type);
}
if (property_exists($videoObject, 'file_size')) {
$video->setFileSize($videoObject->file_size);
}
return $video;
}