Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Responsive Template Image Size

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 01-02-2013, 06:12 AM
 
momentum momentum is offline
 

Senior Member
  
Join Date: Jun 2011
Posts: 120
 

Default Responsive Template Image Size

Hello Great X-cart Users

Hopefully we can all have a profitable New Year

Images should usually not exceed 350 px, or their width and height need to be set as percentage values to allow resizing. Keeping product and category images consistent and reasonably sized is a good idea as well.

My question is how do you make sure the images are percentages and not px? I thought it would be in the css somewhere?

I have to make this site as friendly as possible for the small screen user.
__________________
X-Cart version 4.6.4 GOLD
X-Cart version 4.6.1 GOLD
X-Cart version 4.5.5 GOLD
X-Cart version 4.5.4 GOLD
X-cart Version 4.5.3 GOLD
X-cart Version 4.4.3 GOLD
X-cart Version 4.4.2 GOLD
PHP 5.3.27
MySQL client 5.5.37
Linux
Reply With Quote
  #2  
Old 01-02-2013, 10:50 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Responsive Template Image Size

The product page image size is a complex thing It uses the image size but also the admin settings image size on appearance page and also size or should I say image holder is calcualted in php script and assign to smarty and then is inline styling....
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #3  
Old 01-03-2013, 05:07 AM
 
momentum momentum is offline
 

Senior Member
  
Join Date: Jun 2011
Posts: 120
 

Default Re: Responsive Template Image Size

Hello

Yes, I agree with you that the image placed on page is complex. Totaltec made the responsive template. In the manual of responsive it says:
"Images should usually not exceed 350 px, or their width and height need to be set as percentage values to allow resizing."

If the above is true I wonder how he expects us to set the images to percentages?

It sounds like a good idea, however, how does one implement his idea?
__________________
X-Cart version 4.6.4 GOLD
X-Cart version 4.6.1 GOLD
X-Cart version 4.5.5 GOLD
X-Cart version 4.5.4 GOLD
X-cart Version 4.5.3 GOLD
X-cart Version 4.4.3 GOLD
X-cart Version 4.4.2 GOLD
PHP 5.3.27
MySQL client 5.5.37
Linux
Reply With Quote
  #4  
Old 01-03-2013, 04:20 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Responsive Template Image Size

The images width/height for the img tag is passed in the template - you can change that to whatever you want.

One thing that may or may not be important - Google SpeedTest will "penalize" if the img tag resizes images with the width/height properties.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #5  
Old 01-04-2013, 06:27 AM
 
momentum momentum is offline
 

Senior Member
  
Join Date: Jun 2011
Posts: 120
 

Default Re: Responsive Template Image Size

Hello cflsystems

I will dig around and see if I can find where to modify that for the images. I am not sure which template I am looking for to set the sizes toe percentages.

It would be nice if the images did re-size if I am using a Iphone. The responsive template works great on the Iphone.
__________________
X-Cart version 4.6.4 GOLD
X-Cart version 4.6.1 GOLD
X-Cart version 4.5.5 GOLD
X-Cart version 4.5.4 GOLD
X-cart Version 4.5.3 GOLD
X-cart Version 4.4.3 GOLD
X-cart Version 4.4.2 GOLD
PHP 5.3.27
MySQL client 5.5.37
Linux
Reply With Quote

The following user thanks momentum for this useful post:
totaltec (01-09-2013)
  #6  
Old 01-09-2013, 06:02 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Responsive Template Image Size

Can you explain exactly the behavior you are looking for? For instance, do you want the images to size down, or up?

Can you determine a set size that you would like to display for mobile, and a set size for desktop? Or do you want them to scale dynamically to fit the space provided?

Are all of your uploaded images the same size, width and height?And to confirm, are we talking about category images or product images?

I am ready to help.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #7  
Old 01-09-2013, 06:14 AM
 
momentum momentum is offline
 

Senior Member
  
Join Date: Jun 2011
Posts: 120
 

Default Re: Responsive Template Image Size

Hello

I was thinking of making all the images the same for this but some times it is hard.

When I make the images I make the width 200px

And details I make 400px

On the I phone it still looks good but in your instructions you mention the images should be set as the following

Images should usually not exceed 350 px, or their width and height need to be set as percentage values to allow resizing. Keeping product and category images consistent and reasonably sized is a good idea as well.

My question is how do you make sure the images are percentages and not px? I thought it would be in the css somewhere?

Not a big deal but just trying to follow along with your great instructions.
__________________
X-Cart version 4.6.4 GOLD
X-Cart version 4.6.1 GOLD
X-Cart version 4.5.5 GOLD
X-Cart version 4.5.4 GOLD
X-cart Version 4.5.3 GOLD
X-cart Version 4.4.3 GOLD
X-cart Version 4.4.2 GOLD
PHP 5.3.27
MySQL client 5.5.37
Linux
Reply With Quote
  #8  
Old 01-09-2013, 06:44 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Responsive Template Image Size

Ah, now I understand. When I made that statement I was referring to images used in your design, or on product pages like in the description. Actual product images have some complicated logic setup, that allows you to control the maximum size of the images from within the admin.

X-cart is designed so that all skill levels can achieve good results, more skilled devs like yourself can dive directly into the templates, and you understand how to properly resize images, not all people do.

I mentioned 350 px because this is the smallest size screen that the template is designed for. Product image sizes are not controlled by CSS currently, to allow the admin side settings to take precedence.

Take a look at /ideal_responsive/customer/main/product.tpl near line 40:
Code:
<div class="image"{if $max_image_width gt 0} style="width: {$max_image_width+12}px;"{/if}> {if $active_modules.Detailed_Product_Images and $config.Detailed_Product_Images.det_image_popup eq 'Y' and $images ne ''} {include file="modules/Detailed_Product_Images/widget.tpl"} {else} <div class="image-box"> {if $active_modules.On_Sale} {include file="modules/On_Sale/on_sale_icon_product.tpl" product=$product} {else} {include file="product_thumbnail.tpl" productid=$product.image_id image_x=$product.image_x image_y=$product.image_y product=$product.product tmbn_url=$product.image_url id="product_thumbnail" type=$product.image_type} {/if} </div> {/if} {if $active_modules.Magnifier and $config.Magnifier.magnifier_image_popup eq 'Y' and $zoomer_images} {include file="modules/Magnifier/popup_magnifier.tpl"} {/if} </div>
Several things are happening here, first look at "<div class="image"{if $max_image_width gt 0} style="width: {$max_image_width+12}px;"{/if}>"
So we see that the container div for the image is based on the $max_image_width variable, which is based on the actual size of the image.

Next we see "{include file="product_thumbnail.tpl" productid=$product.image_id image_x=$product.image_x image_y=$product.image_y product=$product.product tmbn_url=$product.image_url id="product_thumbnail" type=$product.image_type}" This code calls the product thumbnail template, and defines the width and height based on the stored values of the image in the DB.

To make the images "scale" allowing larger images, we need to change both of these lines, and there are a number of ways to do it. One way is to remove the width style from the div container and define the width and height in the CSS, possibly using max-height and max-width. Then we would need to go into the product thumbnail template and remove the code referencing image_x and image_y instead setting these values to be percentage based. An easy trick is to not define both width and height, just define one setting like width, and the height should scale accordingly.

Then you can set the maximum width for that div container using CSS, and you can define it specifically for the different style sheets and thereby screen sizes. Make sense?
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:13 AM.

   

 
X-Cart forums © 2001-2020