Get height and width dimensions from base64 PNG

后端 未结 5 703
北海茫月
北海茫月 2020-12-15 23:19

I have this

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOcAAABnCAYAAAD7RFX4AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFP         


        
5条回答
  •  感动是毒
    2020-12-15 23:54

    With jQuery:

    var width, height;
    $('').load(function(){
        width = $(this).width();
        height = $(this).height();
        // Call whatever function here that requires the width/height
    }).attr('src', datauri)
    

提交回复
热议问题