show uploaded image without page refresh

Home Forums WPAlchemy show uploaded image without page refresh

This topic contains 1 reply, has 2 voices, and was last updated by  andymoonshine 1 year, 10 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2522

    organicflash
    Participant

    Hello, I’ve been using wpalchemy for a while and appreciate it very much.  I often use the media uploader in particular.  One thing I am having difficulty doing is to show the image I’ve just uploaded immediately rather than saving and refreshing the page.  I think I could write something to do this, but before I go an make a mess I was wondering if a relatively simple solution already exists.

    Anybody do this?

    thank you!

     

    #2532

    andymoonshine
    Participant

    I did something similar recently using & also attached a shadowbox

    I hid the input field and used a change event to see when it had been updated

    jQuery(function($) {

    Shadowbox.init({

    overlayOpacity: 0.8

    });

    $.wpalchemy.bind('wpa_copy', function(the_clone) {

    imageAdded();

    });

    function imageAdded() {

    $('.wpa_group-projectimage').each(function(e) {

    var par = $('p', this);

    $('input:text', this).css('display','none');

    $('input:text', this).bind('change', function(event) {

    Shadowbox.init({

    skipSetup:true

    });

    par.html(' ');

    });

    });

    }

    imageAdded();

    $('a.shadowlink').live('click',function(event){

    Shadowbox.setup($('.shadowlink'));

    Shadowbox.open(this);

    event.preventDefault();

    });

    });

    Also in MediaAccess.php change this line

    wpalchemy_mediafield.val(url);

    to

    wpalchemy_mediafield.val(url).change();

    Or I have just seen this, might be more useful than my hack job! ;)

    https://github.com/farinspace/wpalchemy/pull/42

    Cheers

    Andy

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.