本文整理汇总了PHP中OC\Files\View::searchByMime方法的典型用法代码示例。如果您正苦于以下问题:PHP View::searchByMime方法的具体用法?PHP View::searchByMime怎么用?PHP View::searchByMime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC\Files\View
的用法示例。
在下文中一共展示了View::searchByMime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
public function create($albumPath, $square = false)
{
$albumView = new View($this->view->getRoot() . $albumPath);
$images = $albumView->searchByMime('image', 10);
$count = min(count($images), 10);
$thumbnail = imagecreatetruecolor($count * 200, 200);
for ($i = 0; $i < $count; $i++) {
$thumb = new Thumbnail($albumPath . $images[$i]['path'], $this->user, true);
$image = $thumb->get();
if ($image && $image->valid()) {
imagecopy($thumbnail, $image->resource(), $i * 200, 0, 0, 0, 200, 200);
$image->destroy();
}
}
imagepng($thumbnail, $this->path);
imagedestroy($thumbnail);
}
示例2: refresh
public function refresh()
{
$view = new \OC\Files\View('');
//! need root ?
$gpx_files = $view->searchByMime('application/gpx');
$fileids = array();
foreach ($gpx_files as $fileinfo) {
$fileid = $fileinfo->getId();
$fileids[$fileid] = false;
}
$sql = "select distinct fileid" . " from *PREFIX*gpx_tracks" . " WHERE user_id = ?";
$prep = $this->db->prepare($sql);
$prep->bindValue(1, $this->userId);
$prep->execute($sql);
$filesondb = $prep->fetchAll(\PDO::FETCH_ASSOC);
//return $filesondb;
$lost = array();
foreach ($filesondb as $t) {
$id = $t['fileid'];
if (isset($fileids[$id])) {
$fileids[$id] = true;
} else {
$lost[] = $id;
//on the db but not in filecache
}
}
$done = array();
foreach ($fileids as $fileid => $status) {
if (!$status) {
$this->putAllTracks($fileid);
$done[] = $fileid;
}
}
return $done;
//! TODO remove lost files records
}
示例3: searchByMime
/**
* @param string $query
*/
public static function searchByMime($query)
{
return self::$defaultInstance->searchByMime($query);
}