| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Extending XLite\View\Image to get more info about the image file | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Extending XLite\View\Image to get more info about the image file
I want to be able to read the dimensions of the image so I can change the CSS class used depending if the image is landscape or portrait format.
I imagine I should extend XLite\View\Image but I can't work out what I need to do.
__________________
Core version: 5.5.xx |
|||||||
#2
|
|||||||||
|
|||||||||
Re: Extending XLite\View\Image to get more info about the image file
I guess you should update $this->properties['className'] in a way similar to how the addInlineStyle() method sets the margins when centering the image.
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
#3
|
|||||||
|
|||||||
Re: Extending XLite\View\Image to get more info about the image file
I'm doing this to add in my own CSS class
Code:
I've used this elsewhere to add in Styles and Classes successfully. However I need to somehow find the image dimensions so I can change the class used depending if it's horizontal or vertical. processImage() looks like it might offer something with $this->getParam(self::PARAM_IMAGE) and $this->properties['width'], but I'm not sure what to do.
__________________
Core version: 5.5.xx |
|||||||
#4
|
|||||||||
|
|||||||||
Re: Extending XLite\View\Image to get more info about the image file
You should use something like this:
PHP Code:
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
|
#5
|
|||||||
|
|||||||
Re: Extending XLite\View\Image to get more info about the image file
This is what I've done. Works for me.. might be something in here that helps others.
In image-regular.tpl, image-zoom-quicklook.tpl and image-zoom.tpl I'm calling the widget class... <widget class="\XLite\Module\Client\ClientTheme\View\Produ ctDetailImageSizes" im.... ProductDetailImageSizes.php looks like this: Code:
and in my stylesheet: Code:
__________________
Core version: 5.5.xx |
|||||||
|
#6
|
|||||||||
|
|||||||||
Re: Extending XLite\View\Image to get more info about the image file
Thank you for sharing it with the community!
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
#7
|
|||||||
|
|||||||
Re: Extending XLite\View\Image to get more info about the image file
My code didn't seem to like when the default image was set so I've re-written the class....
Code:
__________________
Core version: 5.5.xx |
|||||||
|
|||
X-Cart forums © 2001-2020
|