0

I am using Jcrop to crop images in my web-application. It works great on all browsers (IE9, FF, Chrome, Safari) except IE8. Specifically, 8.7.6 which ships with Windows 7.

I am using Jcrop v 0.9.9.

In Firefox where it works.I see a structure a DOM like

img id... "style="display:none"

div class="jcrop-holder" ......

.........................
img ........ 

div

Where as in IE 8.7.6, I see the DOM like

img id... "style="display:none"

----Blank-------

Basically, the jcrop-holder is not being injected into the DOM while original image is hidden just like other browsers.

Can you pls. shed some light on this? and If you know any workarounds for IE.

Your help is appreciated.

Javascript Code to attach jcrop to target image

function attachJcropToModal()
{
    jQuery(function($)
    {
        $('#jcrop_target').Jcrop(
                {
                    aspectRatio: '<%=defaultAspectRatioValue%>',
                    minSize: [0,0],
                    onChange: updateCoords,
                    onSelect: updateCoords
                },
                function ()
                {
                    jcrop_api = this;
                }
        );
    });
}

function updateCoords(c)
{
    $('#w').val(Math.round(c.w*adjFactor));
    $('#h').val(Math.round(c.h*adjFactor));

    $('#x1').val(Math.round(c.x*adjFactor));
    $('#y1').val(Math.round(c.y*adjFactor));
}

Html image display code

                <div class="cropperContainer">
                    <table>
                        <tbody><tr>
                            <td class="main">
                                <img id="jcrop_target" src="<%=imgSourceURL%>"<%=overriddenImageWidthAttr%> alt="" />
                            </td>
                        </tr>
                        </tbody></table>
                </div>

1 Answers1

0

Your code looks good, just one thing! You shouldn't use '' around the aspectRatio decimal value.

Jcrop Demo works on IE8, right?

Maybe you should give Cropzoom a try. I used this in a commercial project and after some tweaks it works great for us in IE7+, FF and Safari, etc...

Nikolaj Zander
  • 1,270
  • 9
  • 13