Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2009
    Location
    Originally Pittsburgh, Pa but currently in Philippines
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Question About Cut & Paste jScale Image Scaler v1.0

    I need to be able to resize images for a guestbook script. I understand about the part that goes into the <head> tag and linking to jquery.jScale.js but am running into confusion when it comes to "Call the jScale() method on any jQuery collection of images to scale them. The syntax is:" Does the
    Code:
    jScale(setting, optcallbackfunc)
    belong inside <script type="javascript"> tags. The collection of images will be in a directory named "users" and I just need to be able to set things so that the height does not exceed say 100px and if possible to keep the width from getting more than perhaps double that. The basic syntax I'm using at this point is as follows:
    1. Images are stored in a directory on the server
    2. Image urls are stored in a MySQL database(btw---do I have to apply this to ALL the images on this page?
    print"<tr>\n";
    print" <td width=\"20%\">\n";
    print" <p>$ref->{'name'}\n";
    print" <br />$ref->{'location'}</p>\n";
    print" </td>
    if($ref->{'pic'}) {
    print" <td width=\"60%\">\n";
    print" <p>$ref->{'comments'}</p>\n";
    print" <td width=\"20%\">\n";
    print" $ref->{'image_url'}\n";
    print" </td>\n";
    }

    At any rate that is approx what the table rows will look like. But, how do I call the jScale() method on any jQuery collection of images?
    I hope I provided enough details. If more are needed I can provide them because I'm going to put the perl script for displaying the guestbook submissions together real quick like. Thanx in advance
    Last edited by typomaniac101; 06-25-2009 at 02:34 PM. Reason: forgot something

  • #2
    WA
    WA is offline
    Administrator
    Join Date
    Mar 2002
    Posts
    2,596
    Thanks
    2
    Thanked 19 Times in 18 Posts
    FYI, the link to the script in question is: http://www.javascriptkit.com/script/...le/index.shtml

    To answer your question, the code to call would be something like:

    Code:
    jQuery(document).ready(function($){
      $('img').jScale({h:'100px'})
    })
    The above will affect all images on that page.
    - George
    - JavaScript Kit- JavaScript tutorials and 400+ scripts!
    - JavaScript Reference- JavaScript reference you can relate to.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •