Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3699406
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:05:56+00:00 2026-05-19T05:05:56+00:00

I am using the Jcrop plugin for jQuery for photo manipulation. I finally have

  • 0

I am using the Jcrop plugin for jQuery for photo manipulation. I finally have it working successfully in Firefox and IE8, but am experiencing some weird behavior in Chrome and Safari.

Jcrop code

var api;
$(window.load(function() {
    var orimg = $('#image1');
    //Create Image to get dimensions of full size photo
    var pic = $('<img>').attr('src', orimg.attr('src')).css('display', 'none').appendTo('#form1');
    var h = pic.height();
    var w = pic.width();

    //set defaults for jcrop
    var opt = {
        aspectRatio: 1,
        onSelect: storeCoords, 
        onChange: storeCoords, 
        trueSize: [w, h], //actual size of pic vs. styled size on page
        bgColor: '#EEEEEE',
        bgOpacity: .7,
        setSelect: [150, 150, 50, 50]
    };

    $('#crop_button').click(function() {
        //initialize jcrop
        api = $.Jcrop(orimg, opt);
    });

    $('#cancel_button').click(function() {
        api.destroy();
    });

});

function storeCoords(c) {
    $('#X').val(c.x);
    $('#Y').val(c.y);
    $('#W').val(c.w);
    $('#H').val(c.h);
}

Originally I just thought that it wasn’t storing the coordinates when the storeCoords function was being called. However I added the following code to the storeCoords function to see what was happening:

var msg = '';
$.each(c, function(index, value) {
    msg += index + ':' + value + ' ';
});
$('#debug_output').html(msg + '<br />');

In Firefox and IE it would output the coordinates each resize/move of the crop box. In Chrome/Safari (when using the onChange: property) I get one line of correct data but then it proceeds to overwrite that data with zeros.

  • x:50 y:50 x2:150 y2:150 w:100 h:100
  • x:50 y:50 x2:150 y2:150 w:100 h:100
  • x:0 y:0 x2:0 y2:0 w:0 h:0 x:0 y:0
  • x2:0 y2:0 w:0 h:0 x:0 y:0 x2:0 y2:0
  • w:0 h:0 x:0 y:0 x2:0 y2:0 w:0 h:0
  • x:0 y:0 x2:0 y2:0 w:0 h:0

using the onSelect: property by itself produces all zeros (Chrome/Safari)

So I’m at a loss as to why they are calling/overwriting the values.

EDIT

I’ve updated the code to use $(function(){}) instead of $(window).load(function(){}) and am experiencing the same results. I have put up a demo page that produces the same results. I’m not sure if this is a bug with Jcrop or something I’m doing. It only happens when I specify the trueSize property. The non-minified version of the plugin can be viewed here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T05:05:57+00:00Added an answer on May 19, 2026 at 5:05 am

    I am going to chalk this up to being a bug in the plugin. I’ve submitted a bug report to the project on Google code. I have resorted to resizing the image via the back-end code rather than styling for the interim. Thanks for the suggestions, I will update this if I hear back on the bug.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the jQuery plugin Jcrop. I have an issue with one of
I'm at a loss. I'm using JQuery 1.4.2 and JCrop 0.98. Everything else works
i'm using jCrop and CodeIgniter, trying to make an image uploader. So i have
i am using jcrop to crop pictures on my websites. user can have any
I have an ASP.NET MVC application and I am using two JQuery plugins: colorbox
Using CouchDB 1.0.1. I have DELETEd some documents, then I PUT some other documents
Using online interfaces to a version control system is a nice way to have
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
I want to crop an image at the server side (I am using 'JCrop'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.