Pictures taken after their width and height and then appended to the URL passed to the background value

// Get the picture after their width and height and then appended to the URL pass value back to the format: "jijh.png, wjfiejw.png, wjfiejw.png" 
// first define two global variables naturalWidth and naturalHeight; when clicking Publish when the first picture to get the width and height of each photo, then assignment; and finally passed the pictures back

// Get the image width and height traditional values,
var naturalWidth = [], // acquired wide
    naturalHeight = []; // acquired high
    function getPicter () { 
        . $ ( '. InsertImg') each (function ( index) {
            naturalWidth [index] = $ (the this) [0] .naturalWidth;
            naturalHeight [index] = $ (the this) [0] .naturalHeight;
        })
    
    }   
    var Data} = {
    var imgs = [];
// in img src Road King behind each additional label width / height
    $ (. "Save Photo-Li .insertImg UL"). each (function (index) {
        imgs.push ($ (the this) .attr ( "src") + "?" + "W" + "=" + naturalWidth [index] + "&" + "H" + "=" + naturalHeight [index]);
    })
// back to the required parameters: Pictures format is: " jijh.png,wjfiejw.png,wjfiejw.png"
    data.pictures = imgs.join(",");

Guess you like

Origin blog.csdn.net/weixin_41760500/article/details/80934690