• Resolved cosimo

    (@cosimoamicagmailcom)


    Hi, i’m tryin to create a custom fields in post writing page with add_meta_box. What I want to do is a meta box with an image loader that also allows me to preview the image. If I could also use the wordpress media gallery fot this would be even better. Excuse me for my bad english

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter cosimo

    (@cosimoamicagmailcom)

    I solved with this:

    jQuery(document).ready(function () {
    jQuery('#bottone_carica_anteprima').click(function () {
    formfield = jQuery('#carica_anteprima');
    post_id = jQuery('#post_ID').val();
    tb_show('', 'media-upload.php?post_id=' + post_id + '&type=image&TB_iframe=true');
    return false;
    });
    window.send_to_editor = function (html) {
    imgurl = jQuery('img', html).attr('src');
    jQuery('#carica_anteprima').val(imgurl);
    tb_remove();
    }
    jQuery('#bottone_carica_foto').click(function () {
    formfield = jQuery('#carica_foto');
    post_id = jQuery('#post_ID').val();
    window.send_to_editor = window.send_to_editor_clone;
    tb_show('', 'media-upload.php?post_id=' + post_id + '&type=image&TB_iframe=true');
    return false;
    });
    window.send_to_editor_clone = function (html) {
    imgurl = jQuery('img', html).attr('src');
    jQuery('#carica_foto').val(imgurl);
    tb_remove();
    }
    });

    Found here

    Where do you put this code? Which php file?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘meta box custom fields with images uploader’ is closed to new replies.