jQuery-rwdImageMaps icon indicating copy to clipboard operation
jQuery-rwdImageMaps copied to clipboard

Generated Images Not Processing Correctly

Open LazLong opened this issue 11 years ago • 0 comments

Hi there,

I hit some problems with generated images (resized through a server-side action) not returning size info. Looking at the code I noticed some optimisations that could be made using naturalWidth and naturalHeight from the Image DOM object. I revised the start of the load function as follows:

$('<img />').load(function () {
    var w = $that[0].naturalWidth,
    h = $that[0].naturalHeight;

var wPercent = $that.width() / 100,
    hPercent = $that.height() / 100,
    map = $that.attr('usemap').replace('#', ''),
    c = 'coords';

Dropping out the temp image, this is working reliably on my systems across Chome, IE and Opera (all current versions).

Cheers, Brian

LazLong avatar Jun 27 '14 12:06 LazLong