本文整理汇总了PHP中OC_Helper::getMimetype方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Helper::getMimetype方法的具体用法?PHP OC_Helper::getMimetype怎么用?PHP OC_Helper::getMimetype使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Helper
的用法示例。
在下文中一共展示了OC_Helper::getMimetype方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filemtime
// If preview exist check if it's newer than the file, regenate it otherwise
if (file_exists($thumbPath)) {
$thumbMTime = filemtime($thumbPath);
$fileInfo = \OC\Files\Filesystem::getFileInfo($filePath);
if ($thumbMTime < $fileInfo['mtime']) {
unlink($thumbPath);
}
}
// Check if thumbnail exist, create it otherwise
if (!file_exists($thumbPath)) {
$imgHandler = new \OCA\OCLife\ImageHandler();
$imgHandler->setHeight(320);
$imgHandler->setWidth(320);
$imgHandler->setBgColorFromValues(0, 0, 0);
$imgHandler->generateImageThumbnail($viewPath, $filePath, $thumbPath);
}
$previewPath = is_file($thumbPath) ? $thumbPath : $placeHolderPath;
} else {
$previewPath = $placeHolderPath;
}
}
// Output the preview
$mtime = filemtime($previewPath);
$size = filesize($previewPath);
$mime = \OC_Helper::getMimetype($previewPath);
\OCP\Response::enableCaching();
\OCP\Response::setLastModifiedHeader($mtime);
header('Content-Length: ' . $size);
header('Content-Type: ' . $mime);
$fp = @fopen($previewPath, 'rb');
@fpassthru($fp);
示例2: show
public function show()
{
if ($this->useOriginal) {
$fp = @$this->view->fopen($this->path, 'rb');
$mtime = $this->view->filemtime($this->path);
$size = $this->view->filesize($this->path);
$mime = $this->view->getMimetype($this->path);
} else {
$fp = @fopen($this->path, 'rb');
$mtime = filemtime($this->path);
$size = filesize($this->path);
$mime = \OC_Helper::getMimetype($this->path);
}
if ($fp) {
\OCP\Response::enableCaching();
\OCP\Response::setLastModifiedHeader($mtime);
header('Content-Length: ' . $size);
header('Content-Type: ' . $mime);
fpassthru($fp);
} else {
\OC_Response::setStatus(\OC_Response::STATUS_NOT_FOUND);
}
}
示例3: getThumbnail
/**
* Get the thumbnail of the image
* @param string $thumbImagePath
*/
public function getThumbnail($thumbImagePath)
{
$fp = @fopen($thumbImagePath, 'rb');
$mtime = filemtime($thumbImagePath);
$size = filesize($thumbImagePath);
$mime = \OC_Helper::getMimetype($thumbImagePath);
if ($fp) {
\OCP\Response::enableCaching();
\OCP\Response::setLastModifiedHeader($mtime);
header('Content-Length: ' . $size);
header('Content-Type: ' . $mime);
fpassthru($fp);
} else {
\OC_Response::setStatus(\OC_Response::STATUS_NOT_FOUND);
}
}