php Processwire Images API

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php Processwire Images API相关的知识,希望对你有一定的参考价值。

<?php
// get random image
$image = $page->images->getRandom();
 
// get single image by tag
$page->media->getTag('gallery');
 
// get multiple images by tag
$page->media->findTag('gallery');

// get first image
$page->images->first();

// get image from images field
$page->images->eq(0)
$page->images->eq(1)
$page->images->eq(2)

// delete image
$p->img->removeAll();

// Delete multiple images from page
$i=0;
foreach($p->images as $image){
    if($i++ != 0) $p->images->delete($image);
}

以上是关于php Processwire Images API的主要内容,如果未能解决你的问题,请参考以下文章

php ProcessWire Mail

php ProcessWire管理数据表

php Processwire更改页面创建日期

php Processwire页面URL挂钩

php Processwire表格

php Processwire Google Analytics跟踪