Announcement

Collapse
No announcement yet.

Getting Height and Width values for images

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Getting Height and Width values for images

    Hi,

    I'm customising the 'Extended Info' link. What I want to do is to dynamically make the pop-up window for extended product info the same size (or marginally bigger) than the size of the product image which is to be viewed. I've got it working apart from one snag.

    NETQUOTVAR:IMAGEWIDTH and NETQUOTVAR:IMAGEHEIGHT contain both the size of the image and the following text: "Width=" and "Height="! Is there a way to separate the actual height and width values from the Actinic variables?

    cheers,

    Mike

    #2
    One way is to use some JavaScript to separate out the bits you want:-

    i.e.
    Code:
    in your call to the popup replace NETQUOTEVAR:IMAGEWIDTH
    
    with
    
    'NETQUOTEVAR:IMAGEWIDTH'.match(/\d+/)
    
    and similarly for 
    
    'NETQUOTEVAR:IMAGEHEIGHT'.match(/\d+/)
    This strips out all non numerics from the string.

    Norman
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Thank you Norman. Unfortunately my JavaScript ain't the best. The current line looks like this:

      <A HREF="javascript:ShowPopUp('P_info_NETQUOTEVAR:PRODUCTREF.html',500,600);">See More!</A>

      Can I just plonk your code in to replace '500' and '600', or do I need to parse the variables, pass them to new variable and then plonk them in?

      cheers,

      Mike

      Comment


        #4
        Just plonk them in (single quotes and all) and see what happens.

        By the way - a great way of diagnosing JavaScript is to bung in an alert() statement. For example

        changing your line to be

        Code:
        <A HREF="javascript:alert('NETQUOTEVAR:IMAGEWIDTH'.match(/\d+/));ShowPopUp('P_info_NETQUOTEVAR:PRODUCTREF.html',500,600);">See More!</A>
        Warning. JavaScript should be single word with no space in the middle above.

        Would let you see what the bit of code generates before calling the popup routine.

        Norman
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Thank's Norman. That's working a treat! I was able to further edit the actinicextras.js file in the root of the server to allow me to take off the scrollbars. Now my pop-up window automatically re-sizes to the product image size (+ enough height to allow for the 'close window' message) and appears without scrollbars,

          your a genius!

          cheers,

          Mike :-)

          Comment

          Working...
          X