If the file exists only in the folder structure but not as concrete5 File Object, you need the FileImporter
first:
use Concrete\Core\File\Importer;
$fi = new Importer();
if($fv = $fi->importIncomingFile($themePath . '/' . $filename)){
$returnFile = \Concrete\Core\File\File::getByID($fv->getFileID());
}
Then you may pass that file object to the getThumbNail()
function. The getThumbNail()
doesn't take a path but an image object as first parameter:
$imageHelper = Core::make('helper/image');
$thumbnail = $imageHelper->getThumbnail($returnFile, 300, 9999, false);
Here are all params that are taken (from the API):
/**
* 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)