Jump to content



Photo
* * * * * 1 votes

KissIT Image Thumnailer


  • Please log in to reply
250 replies to this topic

#241   queenzukie

queenzukie
  • Members
  • 672 posts
  • Real Name:Rachael
  • Gender:Female
  • Location:USA

Posted 30 April 2015 - 14:24

Ha! Duh! Thanks! Rookie mistake (even though I've been working with this for 5 years now!) Working like a charm. 

 

You're the best!



#242   queenzukie

queenzukie
  • Members
  • 672 posts
  • Real Name:Rachael
  • Gender:Female
  • Location:USA

Posted 02 May 2015 - 16:11

More questions. 

 

I have the morepics addon installed. I need to add the Image Thumbnailer to the main image on the product info. Current code controlling this is:

<script language="javascript"><!--
document.write('<?php
			echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), (MOPICS_RESTRICT_PARENT=='false'?'':0), (MOPICS_RESTRICT_PARENT=='true'?'':250), 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>';
			?>');
//--></script>

I've tried changing it to this:

<script language="javascript"><!--
document.write('<?php
			echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . 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"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>';
			?>');
//--></script>

And it does not work. (It shows the image in the uploaded size rather than thumbnailing it. 

 

How would I get it to actually resize the main image and save that resized image to the thumbs folder?



#243   raiwa

raiwa
  • Community Sponsor
  • 746 posts
  • Real Name:Rainer Schmied
  • Gender:Male
  • Location:Sant Iscle de Vallalta, Barcelona, Spain

Posted 02 May 2015 - 16:50

@queenzukie,

 

This part of code is for the pop up. You do not need to change any code. It's enough to activate in Admin => configuration => More Pics => Use SMALL_IMAGE_ Restrictions => set to true.

It will then apply the small image size defined in Admin => Configuration => Images.

Of course Small image width and height should be filled in there.



#244   queenzukie

queenzukie
  • Members
  • 672 posts
  • Real Name:Rachael
  • Gender:Female
  • Location:USA

Posted 02 May 2015 - 17:33

@queenzukie,

 

This part of code is for the pop up. You do not need to change any code. It's enough to activate in Admin => configuration => More Pics => Use SMALL_IMAGE_ Restrictions => set to true.

It will then apply the small image size defined in Admin => Configuration => Images.

Of course Small image width and height should be filled in there.

 

I have the image loading at the proper size, its the file size that worries me. It's loading a large image shrunk down to 250 px wide. It's loading them slow (line by line) and I was wondering if the main image could be cached in the thumbs folder at its smaller size (250 px) so it loads quicker on the product info page. 



#245   raiwa

raiwa
  • Community Sponsor
  • 746 posts
  • Real Name:Rainer Schmied
  • Gender:Male
  • Location:Sant Iscle de Vallalta, Barcelona, Spain

Posted 02 May 2015 - 18:24

@queenzukie,

 

ok, I made a mess, this has nothing to do with extra images.

Did you add the KISSIT_MAIN_PRODUCT_IMAGE_WIDTH and KISSIT_MAIN_PRODUCT_IMAGE_HEIGHT configuration entries??

Please Check in Admin => Configuration => Images =>

Can you check in the source code in your browser that you get a numeric value for image size in the main image??



#246   queenzukie

queenzukie
  • Members
  • 672 posts
  • Real Name:Rachael
  • Gender:Female
  • Location:USA

Posted 02 May 2015 - 23:30

I went back over the instructions and this thread. It appears as though I have some very old code (which I've modified 100 times) and I do not have bxGallery anywhere. 

 

So since I don't have bxGallery when I followed this instruction:

 

 

dd the following lines immediately ABOVE the closing ?> at the bottom of the file ( set to your own choice of image size )

  // Width and height of the main product_info.php image
  
define 'KISSIT_MAIN_PRODUCT_IMAGE_WIDTH'300 );
  
define 'KISSIT_MAIN_PRODUCT_IMAGE_HEIGHT'200 );

 

It really does nothing for me. I don't have anything I can edit in the admin -> images area that is associate with KissIT. 

 

I guess what is working so far is because the wrapper function is used ( tep_image() )

 

I do however have this in the admin -> images area:

 

 

Product Information Image Width 250

Product Information Image Height 0

 

Now, when I look at the code which is actually controlling that main image on the product_info.php this is what I see:

<script language="javascript"><!--
document.write('<?php
			echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), (MOPICS_RESTRICT_PARENT=='false'?'':0), (MOPICS_RESTRICT_PARENT=='true'?'':250), 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>';
			?>');
//--></script>

If I change that MOPICS_RESTRICT_PARENT=='true'?'':250 to something like 137, it actually changes the main image on the site. So I do not believe it's even pulling that main image from the admin -> images setting. 

I hope I haven't completely confused you! I am just at a bit of a loss trying to get this particular area to work. 



#247   raiwa

raiwa
  • Community Sponsor
  • 746 posts
  • Real Name:Rainer Schmied
  • Gender:Male
  • Location:Sant Iscle de Vallalta, Barcelona, Spain

Posted Yesterday, 13:21

@queenzukie,

 

you have a for me unknown version of more pics.

try this:

			echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), 250, 250, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>';

and use there instead of 250 the size you wish



#248   kenners

kenners
  • Members
  • 3 posts
  • Real Name:Kenneth

Posted Yesterday, 14:06

Hopefully this can get fixed for the next version but I was having an issue with upscaling images (outputting with a black background and the image came out far too large).

 

Modified the Image.php file on line 270 to 

 imagecopyresampled ( $new_image, $this->_image, ($max_width-$this->_width)/3, ($max_height-$this->_height)/3, 0, 0, $max_width, $max_height, $this->_width, $this->_height);

Originally it was $this->_width*2 and the same for height. I'm guessing this was some left over testing code  :)



#249   queenzukie

queenzukie
  • Members
  • 672 posts
  • Real Name:Rachael
  • Gender:Female
  • Location:USA

Posted Yesterday, 14:32

Oh, that didn't work, it just pulled up a blank page. 

 

Here is some code that is working for the little thumbnails (they are being cached to the thumbs folder):

<script language="javascript"><!--
document.write(\'<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id'].'&invis='.(MOPICS_GROUP_WITH_PARENT=='true'?$mo_item:($mo_item+1))).'\\\')">' . tep_image(DIR_WS_IMAGES . $mopics_images[$mo_item], addslashes($product_info['products_name']), (MOPICS_RESTRICT_PARENT=='false'&&$mo_item==0&&MOPICS_GROUP_WITH_PARENT=='true'?'':30), (MOPICS_RESTRICT_PARENT=='false'&&$mo_item==0&&MOPICS_GROUP_WITH_PARENT=='true'?'':30), 'hspace="5" vspace="5"') . '</a>\');
//--></script><noscript>
<a href="' . tep_href_link(DIR_WS_IMAGES . $mopics_images[$mo_item]) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $mopics_images[$mo_item], $product_info['products_name'], '0', '60', 'hspace="5" vspace="5"') . '</a>
</noscript>

Here is the code I edited (copying from above) and it doesn't show errors, but the main image is not showing on the page. 

<script language="javascript"><!--
document.write(\'<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']). '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), (MOPICS_RESTRICT_PARENT=='false'?'':0), (MOPICS_RESTRICT_PARENT=='true'?'':250), 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>\');
//--></script><noscript>
<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], (MOPICS_RESTRICT_PARENT=='false'?'':60), (MOPICS_RESTRICT_PARENT=='false'?'':60), 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>
</noscript>

I am not sure why the tep_image isn't thumnailing to the thumbs folder. 



#250   raiwa

raiwa
  • Community Sponsor
  • 746 posts
  • Real Name:Rainer Schmied
  • Gender:Male
  • Location:Sant Iscle de Vallalta, Barcelona, Spain

Posted Yesterday, 14:48

@queenzukie,

 

you should check your html output. Most browsers call it source code, or use the shortcut: Ctrl+U.

Then have a look on the image code and check if you have there the image width and height included.

The only need for kissit to work is that you use the tep_image function and pass a numeric value for image height and width.



#251   raiwa

raiwa
  • Community Sponsor
  • 746 posts
  • Real Name:Rainer Schmied
  • Gender:Male
  • Location:Sant Iscle de Vallalta, Barcelona, Spain

Posted Yesterday, 14:49

Hopefully this can get fixed for the next version but I was having an issue with upscaling images (outputting with a black background and the image came out far too large).

 

Modified the Image.php file on line 270 to 

 imagecopyresampled ( $new_image, $this->_image, ($max_width-$this->_width)/3, ($max_height-$this->_height)/3, 0, 0, $max_width, $max_height, $this->_width, $this->_height);

Originally it was $this->_width*2 and the same for height. I'm guessing this was some left over testing code  :)

Thank you @kenners, I'll check it and include it in the next update.