本文整理汇总了PHP中Magento\Catalog\Model\Product\Option::getImageSizeY方法的典型用法代码示例。如果您正苦于以下问题:PHP Option::getImageSizeY方法的具体用法?PHP Option::getImageSizeY怎么用?PHP Option::getImageSizeY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Model\Product\Option
的用法示例。
在下文中一共展示了Option::getImageSizeY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildImageValidator
/**
* @param \Zend_File_Transfer_Adapter_Http|\Zend_Validate $object
* @param \Magento\Catalog\Model\Product\Option $option
* @param array $fileFullPath
* @return \Zend_File_Transfer_Adapter_Http|\Zend_Validate $object
* @throws \Magento\Framework\Exception\InputException
*/
protected function buildImageValidator($object, $option, $fileFullPath = null)
{
$dimensions = [];
if ($option->getImageSizeX() > 0) {
$dimensions['maxwidth'] = $option->getImageSizeX();
}
if ($option->getImageSizeY() > 0) {
$dimensions['maxheight'] = $option->getImageSizeY();
}
if (count($dimensions) > 0) {
if ($fileFullPath !== null && !$this->isImage($fileFullPath)) {
throw new \Magento\Framework\Exception\InputException(__('File \'%1\' is not an image.', $option->getTitle()));
}
$object->addValidator(new \Zend_Validate_File_ImageSize($dimensions));
}
// File extension
$allowed = $this->parseExtensionsString($option->getFileExtension());
if ($allowed !== null) {
$object->addValidator(new \Zend_Validate_File_Extension($allowed));
} else {
$forbidden = $this->parseExtensionsString($this->getConfigData('forbidden_extensions'));
if ($forbidden !== null) {
$object->addValidator(new \Zend_Validate_File_ExcludeExtension($forbidden));
}
}
$object->addValidator(new \Zend_Validate_File_FilesSize(['max' => $this->fileSize->getMaxFileSize()]));
return $object;
}
示例2: getCustomAttributes
/**
* {@inheritdoc}
*/
protected function getCustomAttributes(\Magento\Catalog\Model\Product\Option $option)
{
return [Metadata::FILE_EXTENSION => $option->getFileExtension(), Metadata::IMAGE_SIZE_X => $option->getImageSizeX(), Metadata::IMAGE_SIZE_Y => $option->getImageSizeY()];
}