本文整理汇总了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;
}