Jump to content
Latest News: (loading..)
FWR Media

KissIT Image Thumnailer

Recommended Posts

 <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image'], '', 'NONSSL', false) . '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), KISSIT_MAIN_PRODUCT_IMAGE_WIDTH, KISSIT_MAIN_PRODUCT_IMAGE_HEIGHT, "hspace='5' vspace='5'") . '</a>'; ?>

 

Just the comas: "hspace='5' vspace='5'".

 

Regards,

Gergely

 

This took care of my short tag error when running w3c validator...thanks!


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

@@videod You may or may not be interested in this -

 

A common concern is using file permissions of 777.

 

HostGator does not allow 777 on files which process server-side (i.e. PHP). However, many scripts require you to change your files to 777.

 

I can tell you that 755 will work in lieu of 777. You will not need to use 777 on PHP files or folders.

 

http://support.hostgator.com/articles/cpanel/how-to-change-permissions-chmod-of-a-file

Share this post


Link to post
Share on other sites

First of all, thanks for a well needed addon!

 

Second, I have a small issue. I don't know if it is because of this addon or not, but when I add another image to a product page, everything moves toward the middle. If I remove the second image, everything goes back to where it should be. So this happens as soon as I add a "large image", whether it is one (only showing one picture, but not the same as the thumbnail in listing) or two (the first is the same as listing, and then another one).

Share this post


Link to post
Share on other sites

@ FWR Media

 

Hi Robert,

 

Thanks for your addon. It works great since I installed it.

 

I like to ask you question about the bxGallery. I tried to create a new post but nothing reply there.

I thought you might be able to help as you are familar with image setting.

 

I had installed PIM slideshow, which I make a page to show the slide image.

I like to put a bxGallery thumbnail at the buttom of the slide images.

 

Do I just copy code from product_info.php and paste (which I did and change but doesn't make the slide image thumbnails appear)

or I need to do something else?

 

<?php
if (tep_not_null($slides_info['slides_info'])) {
$pi_query = tep_db_query("select slideshow_image, slideshow_url from " . TABLE_SLIDESHOW . " where slideshow_id = '" . (int)$slideshow_id['slideshow_id'] . "' order by last_modified");
if (tep_db_num_rows($pi_query) > 0) {
?>
<div id="piGal" style="float: right;">
<ul>
<?php
$pi_counter = 0;
while ($pi = tep_db_fetch_array($pi_query)) {
$pi_counter++;
$pi_entry = ' <li><a href="';
if (tep_not_null($pi['slideshow_url'])) {
$pi_entry .= '#piGalimg_' . $pi_counter;
} else {
$pi_entry .= tep_href_link(DIR_WS_IMAGES_SLIDESHOW . $pi['slideshow_image'], '', 'NONSSL', false);
}
$pi_entry .= '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES_SLIDESHOW . $pi['slideshow_image']) . '</a>';
if (tep_not_null($pi['slideshow_url'])) {
$pi_entry .= '<div style="display: none;"><div id="piGalimg_' . $pi_counter . '">' . $pi['slideshow_url'] . '</div></div>';
}
$pi_entry .= '</li>';
echo $pi_entry;
}
?>
</ul>
</div>
<script type="text/javascript">
$('#piGal ul').bxGallery({
maxwidth: 300,
maxheight: 200,
thumbwidth: <?php echo (($pi_counter > 1) ? '75' : '0'); ?>,
thumbcontainer: 300,
load_image: 'ext/jquery/bxGallery/spinner.gif'
});
</script>
<?php
} else {
?>
<div id="piGal" style="float: right;">
<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES_SLIDESHOW . $slides_info['slideshow_image'], '', 'NONSSL', false) . '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES_SLIDESHOW . $slides_info['slideshow_image'], addslashes($slides_info['slideshow_name']), null, null, 'hspace="5" vspace="5"') . '</a>'; ?>
</div>
<?php
}
?>
<script type="text/javascript">
$("#piGal a[rel^='fancybox']").fancybox({
cyclic: true
});
</script>
<?php
}
?>

 

CREATE TABLE IF NOT EXISTS `slideshow` (
`slideshow_id` int(11) NOT NULL auto_increment,
`slideshow_name` varchar(255) NOT NULL default '',
`slideshow_description` text NOT NULL,
`slideshow_image` varchar(255) default NULL,
`slideshow_url` tinytext NOT NULL,
`date_added` datetime default NULL,
`last_modified` datetime default NULL,
PRIMARY KEY (`slideshow_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

 

many thanks in advance.

 

Lyn

Share this post


Link to post
Share on other sites

I imagine this is a great addon, but we're having some issues with it. Wonder if anyone can help? Basically the new image is corrupted and never actually shows. Looking in the web server logs reveals this error:

 

gd-png: fatal libpng error: zlib failed to initialize compressor -- stream error
gd-png error: setjmp returns error condition

 

And these errors too: (I think this has to do with the corrupt image being created:

 

[sat Nov 24 00:57:00 2012] [error] [client <ip_address>] client denied by server configuration: /path/to/osc/images/index.php, referer: http://<url>/osc/index.php?cPath=23_25_26_27

 

Also if I do "view image" I get this image:

 

http://dl.dropbox.com/u/73185298/KissIT_image_thumbnailer_error.png

 

If I copy the created image locally it says it's a corrupt image and cannot be opened and it's only 1KB in size.

 

I'm searching around for answers but nothing concrete yet. I did find some possible answers but they are not in English and the translations seem unclear.

 

Any help would be appreciated!

 

Thanks,

 

Jason

 

Info:

 

Debian 6.0.5

Apache 2.2.16

PHP 5.3.3

osC 2.3.3

 

Addon from here: http://addons.oscommerce.com/info/8495

Edited by Superman710e

Share this post


Link to post
Share on other sites

I imagine this is a great addon, but we're having some issues with it. Wonder if anyone can help? Basically the new image is corrupted and never actually shows. Looking in the web server logs reveals this error:

 

gd-png: fatal libpng error: zlib failed to initialize compressor -- stream error
gd-png error: setjmp returns error condition

 

And these errors too: (I think this has to do with the corrupt image being created:

 

[sat Nov 24 00:57:00 2012] [error] [client <ip_address>] client denied by server configuration: /path/to/osc/images/index.php, referer: http://<url>/osc/index.php?cPath=23_25_26_27

 

Also if I do "view image" I get this image:

 

http://dl.dropbox.com/u/73185298/KissIT_image_thumbnailer_error.png

 

If I copy the created image locally it says it's a corrupt image and cannot be opened and it's only 1KB in size.

 

I'm searching around for answers but nothing concrete yet. I did find some possible answers but they are not in English and the translations seem unclear.

 

Any help would be appreciated!

 

Thanks,

 

Jason

 

Info:

 

Debian 6.0.5

Apache 2.2.16

PHP 5.3.3

osC 2.3.3

 

Addon from here: http://addons.oscommerce.com/info/8495

 

I think it might be related to the quality value being passed to the imagepng function. I tested by uploading a jpeg instead, and that works fine.

 

http://www.at-byte.com/technology/gd-png-fatal-libpng-error-zlib-error

 

However, looking at the code (and not being proficient at PHP) I am unable to find a location where the value is limited for png, and I am not sure how to add such a feature.

 

Thanks,

Jason

Share this post


Link to post
Share on other sites

I think it might be related to the quality value being passed to the imagepng function. I tested by uploading a jpeg instead, and that works fine.

 

http://www.at-byte.com/technology/gd-png-fatal-libpng-error-zlib-error

 

However, looking at the code (and not being proficient at PHP) I am unable to find a location where the value is limited for png, and I am not sure how to add such a feature.

 

Thanks,

Jason

 

So I hacked together a possible solution. In /<catalog>/includes/modules/kiss_image_thumbnailer/classes/Image.php I added one line:

 

case self::IMAGETYPE_PNG :
	 $quality = is_null ( $quality ) ? 0 : $quality;
	 $quality = ($quality > 9) ? $quality=floor($quality / 10) : $quality;
	 $filters = is_null ( $filters ) ? null : $filters;
	 return imagepng ( $this->_image, $save_in, $quality, $filters );
	 break;

 

The text below in bold and red was injected at line 145.

 

$quality = ($quality > 9) ? $quality=floor($quality / 10) : $quality;

 

In a very simple test it seems to be working. But you will have to first delete any previously created png images from /<catalog>/includes/modules/kiss_image_thumbnailer/thumbs.

 

Thanks,

Jason

Edited by Superman710e

Share this post


Link to post
Share on other sites

I have just installed this contribution, and I have some problems with the aspect ratio of the images on the product_info.php page. Some of my images are square and some are rectangles how to I maintain aspect ratio ?

 

My images are as follows,

150px on the long edge (thumbnail)

475px on the long edge (product_info)

950px on the long edge (click image on product_info page)

 

what do I have to do to correct the, my images are already uploaded, just in different directories.

 

Any help would be appreciated.

 

Oscommerce 2.3.3

Contributions Installed

MTS

SPPC

Secrity Pro

Share this post


Link to post
Share on other sites

Hello,

I have installed the addon and it seems to work only for the image in product_info.php. Does this addon not generate thumbs for images elsewhere on a site (index.php, products_new.php etc...)?

If so, what did I do wrong?

If not, does anyone know of a solution?

Thanks,

-Alex

Share this post


Link to post
Share on other sites

In istallation html it says:The first time you run a page it may seem slow as the thumbs are generated, subsequent loads should be fast as the thumbnailer has done its work.

 

Are the thumbs generated for every visitor separately and stored in customer computer or the thumbs are generated only once and every next customer gets the resized images already? Or does every customer have to wait long for the first load?

 

Somebody please answer!

Share this post


Link to post
Share on other sites

I thought i would share here a slight modification for those not wanting the extra background padding it generates when using the

 

$_take_resize_dimensions_as_absolute = true

 

By setting this to false disables this extra padding - and the generated thumb will indeed look perfect - when its first generated.

 

However on making a browser refresh the script will check for the presence of a thumb - which will of course be found - but will use the dimensions passed originally to the script which will cause the browser to stretch / skew the image to fit the size.

 

This modified function will instead use the actual size of the already generated thumb.

 

includes/modules/kiss_image_thumbnailer/classes/Image_Helper.php

 

the new checkImage function is as follows

 

protected function _checkImage() {
 if ( !is_file ( $this->src ) ) {
 $this->src = $this->default_missing_image;
 }
 $image_path_parts = pathinfo ( $this->src );
 $this->_image_name = $image_path_parts['basename'];
 $this->_thumb_filename = $this->attributes['width'] . 'x' . $this->attributes['height'] . '_' . $this->_image_name;
 $this->_thumb_src = $this->thumbs_dir_path . $this->_thumb_filename;
 if ( is_readable ( $this->_thumb_src ) ) {
 $imagegen = @getimagesize($this->_thumb_src);

 //$this->_calculated_width = $this->attributes['width'];
 //$this->_calculated_height = $this->attributes['height'];

$this->_calculated_width = $imagegen[0];
 $this->_calculated_height = $imagegen[1];
 $this->src = $this->_thumb_src;
 return 'no_thumb_required';
 }
 if ( !$this->_original_image_info = getimagesize ( $this->src ) ) {
 return 'abort';
 }
 if (!in_array ( $this->_original_image_info['mime'], $this->_valid_mime ) ) {
 return 'abort';
 }
} // end method

 

subsequent refreshes / pageloads wont stretch the thumb

 

Jules

 

edit: this needs

 

$_take_resize_dimensions_as_absolute = false;

 

setting in Image.php

Edited by thejudge99

Share this post


Link to post
Share on other sites

Hello,

I've installed this addon and it's working properly but when I upload an image in the same dimension as the output dimension, the thumbnailer is ignored and the original image is displayed. Anyone knows a setting for fixing that? Or I'm doing something wrong...

Thanks.

Share this post


Link to post
Share on other sites

Hy again,

 

I found that removing these lines:

 

 if ( !$this->_original_image_info = getimagesize ( $this->src ) ) {
return 'abort';
}
if (!in_array ( $this->_original_image_info['mime'], $this->_valid_mime ) ) {
return 'abort';
}

 

in Image_Helper.php somehow did the trick.

Can anyone tell me if those lines are important?

 

Thanks.

Share this post


Link to post
Share on other sites

Is there way to keep the proportions of the image but without the blank (or any colour) background? I mean the thumbnail taking the whole space even if it means that some part of the image is hidden? (overflow: hidden kind of thing)

Share this post


Link to post
Share on other sites

Is there way to keep the proportions of the image but without the blank (or any colour) background? I mean the thumbnail taking the whole space even if it means that some part of the image is hidden? (overflow: hidden kind of thing)

My modification posted above achieves this

Share this post


Link to post
Share on other sites

My modification posted above achieves this

 

Yeah I had something different in mind, that I thought about it and decided that was useless anyway. I did use your modification and works fine, but I have a small issue. I don't know if it's something that doesn't work or some other modification that affects it.

 

Basically I have vertical and horizontal images. The thumbnails of the horizontal images are stretched (the height) in order to occupy the same height as the vertical ones. Any ideas?

Edited by vourlismenos

Share this post


Link to post
Share on other sites

that has been done quite a few times and is not working. The main image is fine, the smaller thumbnails for the extra images just stretch :/

Share this post


Link to post
Share on other sites

@@vourlismenos

 

Create proper images that are proportionally correct or you could try only entering one dimension in the image size area within your admin images configuration.


REMEMBER BACKUP, BACKUP AND BACKUP

Before installing the official version of oscommerce first look at a responsive version here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

sounds like your extra Images are actually smaller than the space youve set they should be. Test it by making sure all your Images are bigger than the space you set them to be.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×