Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Image Divide by zero error


LunchBox

Recommended Posts

Arrrrrrrrrrgggggggggggghhhhhhhhhhhhh!!!!!

 

I'm now pulling my hair out over this.

 

With my local installation I get no errors at all.

 

Uploaded to my server and when there is no image I'm getting a divide by zero error.

 

I've made a change to resize images.

 

   if ( ($width) && ($height) ) {

    $image_size = @getimagesize($src);

    $ratio = $width / $image_size[0];

    if ($image_size[1]*$ratio > $height) {

      $ratio = $height / $image_size[1];	

      $width = $image_size[0] * $ratio;

    } else {

   $height = $image_size[1] * $ratio;

    }



       $image .= ' width="' . $width . '" height="' . $height . '"';

  }

 

The error is occuring on the third line.

 

Only happens on the web server.

 

Please help.........

 

J.

Gravity is a myth - the Earth sucks!

Link to comment
Share on other sites

What is the result of getimagesize() ?

That is probably your error but the @ stops it from reporting.

Remove the @ and see what it tells you.

I'm quite sure it doesn't return the array with the sizes like expected...

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

Quite right ( as ever :) )

 

It's reporting an error:

 

Warning: getimagesize: Unable to open 'images/Array' for reading. in /home/temptation/www/catalog/includes/functions/html_output.php on line 108

 

Any ideas? Could it be folder permissions?

 

J.

Gravity is a myth - the Earth sucks!

Link to comment
Share on other sites

might be permissions yes... but in this case you have tried to upload an Array as the image path... so in your products table it states 'Array' instead of my_nice_image.jpg...

 

fix that, check the permissions on the folder / images and you should be okay...

 

hth

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

Small problem...

 

It's not happening for a product (although I have found 2 products that do).

 

It's happening between the category title and the product listings...

 

http://www.fetishheaven.co.uk/catalog/defa....php?cPath=5_24

 

Warning Adult content.

 

Cheers,

 

J.

Gravity is a myth - the Earth sucks!

Link to comment
Share on other sites

Look for the Array bit in the categories table.

Nice parachute but I think I'll pass ;)

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

Nope it's not that.

 

What get's drawn there? The category image is being displayed correctly.....

 

I've now got my bum in my hands. Not going to bed until this is fixed. Wife very unhapy.

 

Don't understand why it's working OK on laptop, but not on server.

 

Hmmmmmmmmm.........

 

J.

Gravity is a myth - the Earth sucks!

Link to comment
Share on other sites

if so look in the html source on the laptop what is drawing there...

ah... come to think of it:

 

pixel_trans.gif

 

might be it... it used for spacers etc.

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

It appears to be dying in product_listing.php

 

  $list_box_contents = array();

 $list_box_contents[] = array('params' => 'class="productListing-heading"');

 $cur_row = sizeof($list_box_contents) - 1;



 for ($col=0; $col<sizeof($column_list); $col++) {

   switch ($column_list[$col]) {

     case 'PRODUCT_LIST_MODEL':

       $lc_text = TABLE_HEADING_MODEL;

       $lc_align = 'left';

       break;

 

Something to do with this.......???????

 

Help please.

 

J.

Gravity is a myth - the Earth sucks!

Link to comment
Share on other sites

don't think so. That code builds the headings but does not call tep_image() which is causing the error... Did you look at the html source on the laptop?

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

Laptop isn't drawing anything.....

 

The server source is....

 

  <tr>

   <td><img src="images/pixel_black.gif" border="0" alt="" width="1" height="1"></td>

 </tr>

 <tr>

   <td>

<br />

<b>Warning</b>:  getimagesize: Unable to open 'images/Array' for reading. in <b>/home/temptation/www/catalog/includes/functions/html_output.php</b> on line <b>108</b><br />

<br />

 

The laptop is...

 

  <tr>

   <td><img src="images/pixel_black.gif" border="0" alt="" width="1" height="1"></td>

 </tr>

 <tr>

   <td>

<table border="0" width="100%" cellspacing="0" cellpadding="2">

 <tr class="productListing-heading">

   <td align="center" class="productListing-heading">  </td>

   <td align="left" class="productListing-heading"> <a href="http://localhost/catalog/default.php?cPath=5_24&page=1&sort=2d" title="Sort products descendingly by Product Name">Product Name+</a> </td>

 

J.

Gravity is a myth - the Earth sucks!

Link to comment
Share on other sites

I'm an idiot. :oops: :stupid:

 

I was expecting the error to occur where the images where missing. But it builds the list first and then displays them.

 

Fixing the Array in the products_images fixed the problem.

 

But why did it not complain on the laptop?

 

A question for another day. I'm going to bed.

 

Thanks for all your help Mattice. I owe you one :)

 

Good Morning.

Gravity is a myth - the Earth sucks!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...