Forums / All Other Contributions/Addons / Jquery Zoom [Support thread]

Jquery Zoom [Support thread]

Started by yellow1912 on 3 Jan 2009, 8:26 PM · Views: 82,425

Results 321 to 340 of 385
8 Feb 2013, 5:51 PM
#321
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Jquery Zoom [Support thread]

The jqzoom will work with whatever size files, it checks which file exists and uses the most appropriate so I guess the only think that would need I merge like you say it the bit that creates an image if it doesn't yet exist.

Phil Rogers
A problem shared is a problem solved.

8 Feb 2013, 5:57 PM
#322
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Jquery Zoom [Support thread]

Let me perfect a standalone version then once sorted I will help you create the files that are also compatible with image handler.

I think it's important to have both as this mod is also great for non image handler users too, so I think we should create two different filesets. (Or alternate file for IH users)

Phil Rogers
A problem shared is a problem solved.

8 Feb 2013, 6:06 PM
#323
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Jquery Zoom [Support thread]

Not somehow. It uses either imagemagick if it is available on the server, or GD, if it is not. Then it caches the scaled image for later use. That bit is not all that complex.

yeah, jqzoom works fine. the issue is that the src that appears in the link may not actually exist yet. If you always zoom to the originally uploaded image then that is not a problem. But IH has the abiltiy to scale the large images too. Why? Because it makes the large images that are used consistent. So, all the big images are, for instance 800 by 800 regardless of how big the uploaded image is. That makes the pop-up or the lightbox or whatever look more consistent.

(Again I approach this a bit differently. In my case I scale the images on upload. Which lets my clients upload whatever they want but the image that gets stored on the server is a maximum of 800 by 800 or whatever)

So, if the user is scaling the big images. Then when the <a> tag for jqzoom is created it might contain an image that does not actually exist as yet. At which point you get a 'zoom loading' which never goes away.

IH I believe has alterations to almost all the files that you are working on. So the quick fix is to preload the images so that you know that they have been created. But it is not perfect

Nick
iszent.com

8 Feb 2013, 6:07 PM
#324
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Jquery Zoom [Support thread]

Building two versions is a good way to go :-)

Nick

Nick
iszent.com

8 Feb 2013, 6:08 PM
#325
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Jquery Zoom [Support thread]

Qz won't use a link for a source that doesn't exist, that's what I'm saying ;-)

Phil Rogers
A problem shared is a problem solved.

8 Feb 2013, 6:09 PM
#326
chadderuski avatar

chadderuski

Totally Zenned

Join Date:
Apr 2006
Location:
Dark Side of the Moon
Posts:
986
Plugin Contributions:
0

Re: Jquery Zoom [Support thread]

Philip,

I was just going to suggest this. In fact, perhaps you don't need to merge anything with IH. Maybe the IH dev's will incorporate your code!

One of the big things the IH4 does is to resize and cache your images so you don't have to create _LRG _MED etc images ... Big time saver.

8 Feb 2013, 6:13 PM
#327
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Jquery Zoom [Support thread]

Basically what I'm saying is, the way I coded this it shouldn't matter what file exists yet.. As long as there is a small medium or large.

So I'm saying the only think missing would be the creating correct sizes bit

Am I making sense?

Phil Rogers
A problem shared is a problem solved.

9 Feb 2013, 9:34 AM
#328
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Jquery Zoom [Support thread]

Yeah, ok, well I think you need to look at IH.

the thing is that IH doesn't store the images in the _LRG folder ( for example) It caches them. So the logic isn't going to find them.

But I agree that working on a non IH version is just fine.

Nick
iszent.com

9 Feb 2013, 10:07 AM
#329
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Jquery Zoom [Support thread]

niccol:

Yeah, ok, well I think you need to look at IH.

the thing is that IH doesn't store the images in the _LRG folder ( for example) It caches them. So the logic isn't going to find them.

But I agree that working on a non IH version is just fine.

Shouldn't be a problem mate. I've been thinking ill just copy the logic of IH and apply that IF IH is installed and so the default logic if not. Job done!

I will just have to take some time to study the workings of IH.

:-)

Phil Rogers
A problem shared is a problem solved.

11 Feb 2013, 2:22 PM
#330
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Jquery Zoom [Support thread]

Nick,

ok so I have started to look at the IH logoic. happy with the main product image file, seems pretty straight forward. however, seriously struggling to understand the login in the additional images file - especially as the images are not stored in the /medium and /large folders!

so heres how I am reading it:

below $products_image_large for the additional image in the loop is defined as
images/large/file_a.jpg

then they remove the check to see if the large file exists, and then manually set the value to true
// $flag_has_large = file_exists($products_image_large);
$flag_has_large = true;

thus now regardless of the file actually exisitng or not, telling the scrip it does exist.

for ($i=0, $n=$num_images; $i<$n; $i++) {
    $file = $images_array[$i];
    $products_image_large = str_replace(DIR_WS_IMAGES, DIR_WS_IMAGES . 'large/', $products_image_directory) . str_replace($products_image_extension, '', $file) . IMAGE_SUFFIX_LARGE . $products_image_extension;
//  Begin Image Handler changes 1 of 2
//next line is commented out for Image Handler
//  $flag_has_large = file_exists($products_image_large);
    $flag_has_large = true;
//  End Image Handler changes 1 of 2

then, the $products_image_large is redefined by testing against the value $flag_has_large which above was set to true so therefore the large image is defined as:
/images/large/file_a.jpg

    $products_image_large = ($flag_has_large ? $products_image_large : $products_image_directory . $file);
    $flag_display_large = (IMAGE_ADDITIONAL_DISPLAY_LINK_EVEN_WHEN_NO_LARGE == 'Yes' || $flag_has_large);
    $base_image = $products_image_directory . $file;
    $thumb_slashes = zen_image(addslashes($base_image), addslashes($products_name), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
//  Begin Image Handler changes 2 of 2
//  remove additional single quotes from image attributes (important!)
    $thumb_slashes = preg_replace("/([^\\\\])'/", '$1\\\'', $thumb_slashes);
//  End Image Handler changes 2 of 2
    $thumb_regular = zen_image($base_image, $products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
    $large_link = zen_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL, 'pID=' . $_GET['products_id'] . '&pic=' . $i . '&products_image_large_additional=' . $products_image_large);

then the $products_image_large is used in the link:

    // Link Preparation:
    $script_link = '<script language="javascript" type="text/javascript"><!--' . "\n" . 'document.write(\'' . ($flag_display_large ? '<a href="javascript:popupWindow(\\\'' . str_replace($products_image_large, urlencode(addslashes($products_image_large)), $large_link) . '\\\')">' . $thumb_slashes . '<br />' . TEXT_CLICK_TO_ENLARGE . '</a>' : $thumb_slashes) . '\');' . "\n" . '//--></script>';

    $noscript_link = '<noscript>' . ($flag_display_large ? '<a href="' . zen_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL, 'pID=' . $_GET['products_id'] . '&pic=' . $i . '&products_image_large_additional=' . $products_image_large) . '" target="_blank">' . $thumb_regular . '<br /><span class="imgLinkAdditional">' . TEXT_CLICK_TO_ENLARGE . '</span></a>' : $thumb_regular ) . '</noscript>';

so this to me is magic if it works as if the large does't exist there must be a part of image handler somewhere that is the directory is called that instead of using the file it creates the cache file? is that how it works?

if so, then all I need to do is remove the image file checking. do you know exactly how IH works and if what I am assuming is correct?

Phil Rogers
A problem shared is a problem solved.

11 Feb 2013, 2:39 PM
#331
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Jquery Zoom [Support thread]

Sorry, a bit snowed under at the moment.

Basically, the 'magic' happens in function zen_image . In there there is a function 'handle_image' which acts as a hook for all the IH stuff. Or any other image manipulation you might want to do. So, that is where IH hooks into the existing system.

But :

below $products_image_large for the additional image in the loop is defined as
images/large/file_a.jpg

Don't understand what you are saying here. where is 'file_a.jpg' coming from?

Nick
iszent.com

11 Feb 2013, 2:42 PM
#332
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Jquery Zoom [Support thread]

just using that as an example..

I looked at some more of the code and I think my assumption is correct. I think basically it works when the file is not found.

show the link still points to

images/large/thefile.jpg

when it doesnt exist it creates the cache version and uses that for it there after..

so the links dont actually need to change, its just the physical checking to see if the file exists needs to be removed.

When i get some time I will re-write for you to test.

Phil Rogers
A problem shared is a problem solved.

11 Feb 2013, 2:53 PM
#333
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Jquery Zoom [Support thread]

Well, I am absolutely the wrong person to test that. As I said I don't use IH.

But I am not sure of the point you are making. IH works anywhere a call is made to handle_image. The heavy lifting is done in the ih_image class.

The handle image where some of the logic is found is in functions_bmz_ something-or-other

Nick
iszent.com

11 Feb 2013, 3:03 PM
#334
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Jquery Zoom [Support thread]

niccol:

Well, I am absolutely the wrong person to test that. As I said I don't use IH.

But I am not sure of the point you are making. IH works anywhere a call is made to handle_image. The heavy lifting is done in the ih_image class.

The handle image where some of the logic is found is in functions_bmz_ something-or-other

Don'y worry I know what I mean :oD

Sorry actually I think its chad that uses it. chad will have to be the test driver once i've re-written.

the point i was making is I was tryin gto understand the trigger for creating and calling cache images. the answer is within the zen_image as you say, when you request an image that doesnt exist in the large directory. i.e images/large/image.jpg it triggetrs it from there and sets the size based on if you were looking in the medium folder of the large folder.

So where as the current code checks for a large file that exisits, and when it doesnt it checks for a medium, and when it does it uses the base image IH actuallt removes this logic so that regardless whether or not there is a large image in the directory images/large/ it will still use that in the zen_image function... then all the magic happens.

so I just need to remove the part that redfines the $product_image_large after image checks and use that for if IH is installed and NOt if IH isnt installed.

Phil Rogers
A problem shared is a problem solved.

14 Feb 2013, 11:42 AM
#335
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Jquery Zoom [Support thread]

Hi guys, just a quick note to say i havent walked away frm this, just been extremely busy with a website upgrade and other work. Pretty sure I have a solid all around solution, so watch this space and as soon as I have time to put it down I will and upload the files

Phil Rogers
A problem shared is a problem solved.

21 Feb 2013, 5:14 PM
#336
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Jquery Zoom [Support thread]

Hello Phil - Have you looked combining IH and JQzoom yet?

Using Zen Cart 1.5.1

21 Feb 2013, 5:48 PM
#337
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Jquery Zoom [Support thread]

Kevin205:

Hello Phil - Have you looked combining IH and JQzoom yet?

Hi Kevin, its all up in my head, as per my last post as soon as I get time I will update the code and post here for it to be tested.

Phil Rogers
A problem shared is a problem solved.

21 Feb 2013, 5:53 PM
#338
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Jquery Zoom [Support thread]

Great. Thank you.

Using Zen Cart 1.5.1

23 Feb 2013, 4:18 PM
#339
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Jquery Zoom [Support thread]

Attachment #11987

Ok here it is, though I have coded it but NOT TESTED. Give it a go, let me know how it goes. pay attention to the two files you now need to set true or false depending on whether you are running Image Handler or not.

Please report back and let me know if you hit any errors.

Backup as always to be able to revert back. File attatched.

Phil Rogers
A problem shared is a problem solved.

24 Feb 2013, 4:45 AM
#340
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Jquery Zoom [Support thread]

Shouldl IH mod be installed for this test?

Using Zen Cart 1.5.1