Page 1 of 1

Image thumbnail not showing because of old code

Posted: Sun Jan 06, 2013 8:43 pm
by bigbob2
I am new here and I was hoping to get some advice for fixing a little PHP issue I am having. I know almost no PHP, but I am good at tinkering, so with a push in the right direction I can usually get thing to work.

I had a little piece of code written for my old OsCommerce 2.2 MS-2 ecommerce web site that allowed the user to select features that they wanted in a product from a list, then it would return links and thumbnails for the applicable products. The links to the features and images etc. are stored in a text file.
Now that I am moving my site over to the latest version (2.3.3), my model selection tool brings up the links, but the image thumbnails no longer show up. I have tracked it down to the PHP page that interrogates the text file and returns the results. The offending part of the code is the following:

Code: Select all

// get resized dimension of photo
$arr_dimension = mbr_get_resized_dimension($arr_prod[$k]['image'], $config['thumbnail_max_width']);

// display thumbnail
echo ' <div style="float:left; margin:15px; text-align:center; font-size:12px;">
<a href="'.$arr_prod[$k]['page'].'" onclick="this.target=\'_blank\'">
<img src="'.$arr_prod[$k]['image'].'" width="'.$arr_dimension['width'].'" height="'.$arr_dimension['height'].'" alt="" border="0" />

<br />'.$arr_prod[$k]['model_number'].' 
If I completely remove the first part under "// get resized dimension of photo", then the image shows, but it is huge, not a thumbnail. Can anyone please advise me how I can modify the code to get it to display the image as a 107 pixel wide by 144 pixel high thumbnail? My apologies in advance if this is the wrong forum to ask this question, or if I have left out any relevant info.

Thanks
Kevin

Re: Image thumbnail not showing because of old code

Posted: Sun Jan 06, 2013 10:59 pm
by throwcode
Hi bigbob2,

If the only problem is the dimension of the image, I think you could just set $arr_dimension to the values you want in the thumbnail. Try something like this:

$arr_dimension = array("width" =>107, "height"=>144);

TC

Re: Image thumbnail not showing because of old code

Posted: Mon Jan 07, 2013 1:48 pm
by bigbob2
TC, you my friend are a genius!
Worked like a charm, thank you so much!

Best regards,
Kevin