WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Plugin Media Uploader Description and Caption (3 posts)

  1. Mevludin
    Member
    Posted 2 years ago #

    Code and description:

    I have a question on getting the description and caption from WordPress' Media Uploader through Javascript.
    I am using the media uploader thickbox button in my plugin.
    The code I have to get the src, title and etc is this:
    (
    window.send_to_editor = function (html) {
    var imgurl = jQuery('img',html).attr('src');
    var title = jQuery('img',html).attr('title');
    var width = jQuery('img',html).attr('width');
    var height = jQuery('img',html).attr('height')
    ....
    }
    )
    I've been looking around Google and WordPress' support forum, but I haven't seen anyone show or say how to get the description and caption from the image. Or maybe I overlooked someone's post.
    Question:
    So I was wondering if there was a way to retrieve the description and caption from the images from my media. It can be via javascript or with php.

  2. Mevludin
    Member
    Posted 2 years ago #

    GOT IT.
    Found something which does the job. But I had to change my code due to redundancy. BTW, the Media Uploader is used for my slideshow.
    For those who want to use the Media Uploader, here you go
    http://www.webmaster-source.com/2010/01/08/using-the-wordpress-uploader-in-your-plugin-or-theme
    So in my plugin, I made a settings page using Settings API , and I made the javascript from the link above.
    I used the window.send_to_editor to get the URLS of each image I uploaded and have it save in my $options. And in my register setting validation function I ran a function which got all the data of each file.

    [Code moderated as per the Forum Rules. Please use the pastebin]

    This may have been long, and a lot of you may not need this, but hopefully it helps someone else.

  3. Mevludin
    Member
    Posted 2 years ago #

    Oops, Forum Rules :D

    Here it is for those who would like to know.
    http://pastebin.com/tw4N28CD

Topic Closed

This topic has been closed to new replies.

About this Topic