如果该文件只存在于文件夹结构,但并不像concrete5文件对象,你需要的FileImporter
第一:
use Concrete\Core\File\Importer;
$fi = new Importer();
if($fv = $fi->importIncomingFile($themePath . '/' . $filename)){
$returnFile = \Concrete\Core\File\File::getByID($fv->getFileID());
}
然后你可以将那个文件对象的getThumbNail()
功能。该getThumbNail()
不走的路径,但图像对象作为第一个参数:
$imageHelper = Core::make('helper/image');
$thumbnail = $imageHelper->getThumbnail($returnFile, 300, 9999, false);
下面是采取(从API)所有PARAMS:
/**
* Returns a path to the specified item, resized and/or cropped to meet max width and height. $obj can either be
* a string (path) or a file object.
* Returns an object with the following properties: src, width, height
* @param mixed $obj
* @param int $maxWidth
* @param int $maxHeight
* @param bool $crop
*/
public function getThumbnail($obj, $maxWidth, $maxHeight, $crop = false)
难道我的回答您解决问题? –