本文整理汇总了PHP中OC_Image::getMimeTypeForFile方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Image::getMimeTypeForFile方法的具体用法?PHP OC_Image::getMimeTypeForFile怎么用?PHP OC_Image::getMimeTypeForFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Image
的用法示例。
在下文中一共展示了OC_Image::getMimeTypeForFile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleGetThumbnails
function handleGetThumbnails($albumname)
{
OCP\Response::enableCaching(3600 * 24);
// 24 hour
$thumbnail = OC::$CONFIG_DATADIRECTORY . '/../gallery/' . urldecode($albumname) . '.png';
header('Content-Type: ' . OC_Image::getMimeTypeForFile($thumbnail));
OCP\Response::sendFile($thumbnail);
}
示例2: handleGetThumbnails
function handleGetThumbnails($albumname)
{
OCP\Response::enableCaching(3600 * 24);
// 24 hour
$view = OCP\Files::getStorage('gallery');
$thumbnail = $view->fopen(urldecode($albumname) . '.png', 'r');
header('Content-Type: ' . OC_Image::getMimeTypeForFile($thumbnail));
OCP\Response::sendFile($thumbnail);
}
示例3: testConvert
/**
* @dataProvider convertDataProvider
*/
public function testConvert($mimeType)
{
$img = new \OC_Image(OC::$SERVERROOT . '/tests/data/testimage.png');
$tempFile = tempnam(sys_get_temp_dir(), 'img-test');
$img->save($tempFile, $mimeType);
$actualMimeType = \OC_Image::getMimeTypeForFile($tempFile);
$this->assertEquals($mimeType, $actualMimeType);
}
示例4: handleGetPhoto
function handleGetPhoto($token, $photo)
{
$owner = OC_Gallery_Sharing::getTokenOwner($token);
$view = OCP\Files::getStorage('files');
$file = $view->fopen(urldecode($photo), 'r');
header('Content-Type: ' . OC_Image::getMimeTypeForFile($file));
OCP\Response::sendFile($file);
}
示例5: handleGetPhoto
function handleGetPhoto($token, $photo)
{
$owner = OC_Gallery_Sharing::getTokenOwner($token);
$file = OCP\Config::getSystemValue("datadirectory", OC::$SERVERROOT . "/data") . '/' . $owner . '/files' . urldecode($photo);
header('Content-Type: ' . OC_Image::getMimeTypeForFile($file));
OCP\Response::sendFile($file);
}