Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Flexible Image sizes


Guest

Recommended Posts

Hi There

 

I am trying to find out if there is any way of changing the sizes of images each time you enter a new product.

I am want ing sell images (photographs) on my site and need each image to be seen right.

At the mnute because i can only set every picture the same, some of them look distorted.

 

I would be grateful if any one could shed any light on how i cold get round this!!!

 

Cheers

Gail ;)

Link to comment
Share on other sites

In admin change the image settings to 0 that should allow images to be showing in the size you upload them

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

:D :D :D :D :lol:

 

Thanks Steve, Ive just altered all the image settings that require pixel sizes to 0 and hey presto.

 

 

Thanks very mutch :P

Gail

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...

Here is an interesting question that I have not been able to get an answer to that is bascially the same as this one....with a twist of course :)

 

I created my own thumbnails in Photoshop, set the admin controls to "0", used the thumbs for the main pics, created a seperate folder for the original size pics so when you click on "click to enlarge", but a dead image link appears.

 

So, basically what I want is proportioned thumbs with the original sizes to pop-up when I "click to enlarge".

 

Any ideas?

Link to comment
Share on other sites

Hi folks,

i`ve got problems too.

I am selling posters and some are vertically formatted and some are horizontally formatted. Is there a possibility to scale them by %?

Thanks Maurizio

Link to comment
Share on other sites

  • 5 weeks later...

I've tried both setting both required image sizes to 0 like on this post, and setting width to 100 and height to 0 as in another post, and telling it to calculate image size to true.

 

When I do either of these, the picture goes away completely. When I leave it with default settings, the pictures that are in portrait dimensions apear squashed.

 

looking at cpanel, it looks like the osCommerce version is 2.2ms2

 

Any help would be appreciated.

 

Jeff

Link to comment
Share on other sites

instead of 0 try making blank this will use the size that the image is uploaded

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

I've noticed that I can put a percentage value in there also, but only for the width. I can place 50% in the width and if I put any value in the height field, the images do not show up at all.

 

I think this is a bug with the software. Does anyone know if they are working on fixing this?

 

Thanks,

 

Ray

Link to comment
Share on other sites

I think that a percentage height is the percentage of the height of the enclosing element. Generally, the enclosing element is the same height as the image or a default of 0. Thus, you get a percentage of 0 as the height. As this is a browser property, osCommerce is not going to change it.

 

Percentages are not officially supported. If you want to use percentages to make images a fraction of their original size, you could try the following code.

 

Around lines 87-102 of includes/functions/html_output.php, change

    if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {
     if ($image_size = @getimagesize($src)) {
       if (empty($width) && tep_not_null($height)) {
         $ratio = $height / $image_size[1];
         $width = $image_size[0] * $ratio;
       } elseif (tep_not_null($width) && empty($height)) {
         $ratio = $width / $image_size[0];
         $height = $image_size[1] * $ratio;
       } elseif (empty($width) && empty($height)) {
         $width = $image_size[0];
         $height = $image_size[1];
       }
     } elseif (IMAGE_REQUIRED == 'false') {
       return false;
     }
   }

to

    if (CONFIG_CALCULATE_IMAGE_SIZE == 'true') {
     if ($image_size = @getimagesize($src)) {
       if (substr($width, -1, 1) == '%') {
         $width = $image_size[0] * (substr($width, 0, -1)/100);
       }
       if (substr($height, -1, 1) == '%') {
         $height = $image_size[1] * (substr($height, 0, -1)/100);
       }
       if (empty($width) || empty($height)) {
         if (empty($width) && tep_not_null($height)) {
           $ratio = $height / $image_size[1];
           $width = $image_size[0] * $ratio;
         } elseif (tep_not_null($width) && empty($height)) {
           $ratio = $width / $image_size[0];
           $height = $image_size[1] * $ratio;
         } elseif (empty($width) && empty($height)) {
           $width = $image_size[0];
           $height = $image_size[1];
         }
       }
     } elseif (IMAGE_REQUIRED == 'false') {
       return false;
     }
   }

Hth,

Matt

Always back up before making changes.

Link to comment
Share on other sites

I tried that code and could not get it to work. Each time, I get a parse error about something expecting '). I have meticulously went through and tried several different things in the logic and cannot seem to get it working, even hard-coding the height and the width as $height = $height / 50 and $width = $width / 50.

 

Any suggestions? The problem is, I could say set the width to 50 or 100 and it will make the height proportional but I have some very "thin" images that do not show up well with the small width and I have some "tall" images that are humongous with that width.

 

Thanks,

 

Ray

 

:(

Link to comment
Share on other sites

Each time, I get a parse error about something expecting ').
Each line should have the same number of ( as ). That's what the error says. I copied the code from a working copy, so I suspect that it is something from your edits rather than something in the posted code.

 

Hth,

Matt

Always back up before making changes.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...