Viewing 5 replies - 16 through 20 (of 20 total)
  • Thread Starter Rhand

    (@rhand)

    jQuery(document).ready(function() {
    
    jQuery('#upload_image_button').click(function() {
     formfield = jQuery('#upload_image').attr('name');
     tb_show('','media-upload.php?type=image&TB_iframe=true');
     return false;
    });
    // send url back to plugin editor
    
    window.send_to_editor = function(html) {
     imgurl = jQuery('img',html).attr('src');
     jQuery('#dfrads_textarea').val(imgurl);
     tb_remove();
    }
    
    });

    did the trick to load url inside iamge tag in box. Just had to adjust the JQuery value/class ..

    Thread Starter Rhand

    (@rhand)

    Changed the class in the custom JQuery so url is loaded in proper field. Only need it to load to the proper ad box.

    Thread Starter Rhand

    (@rhand)

    Added jscript to pastebin as well: https://wordpress.pastebin.com/S99tedER . PHP script is still @ https://wordpress.pastebin.com/S99tedER . Main issue still remains the position of the image upload field. It is show below all ad. I should be underneath each add box. But now when a new one is added there is only one upload box and it is below all shown add boxes.

    Thread Starter Rhand

    (@rhand)

    New JavaScript version: https://wordpress.pastebin.com/Q58Bh1AL Had to change id to class to load link into text area. Now I need to wrap it all in an image tag AND to make sure the url goes into the right text area add box..

    What if I wanted to allow them to upload something other than an image file? For example I have this working to a point and allow users to upload a GPX file in my plugin. All I had to do was remove the ‘type=image’ from the tb_show and WordPress will handle what file types can be uploaded for me.

    tb_show(”, ‘media-upload.php?TB_iframe=true’)

    Launching the window and uploading the file is not the problem. It is getting the form text field to be populated with the GFX URL. I know I would have to change these lines….

    imgurl = $(‘img’,html).attr(’src’);
    jQuery(‘#upload_image’).val(imgurl);

    … to get them to look for something other than ‘img’ and ’src’ But what?

    Cheers.

Viewing 5 replies - 16 through 20 (of 20 total)
  • The topic ‘[Plugin: Random / Rotating Ads V2] Image upload option Datafeedr ads’ is closed to new replies.