This support forum is no longer in use. Please use the Cloudinary Community at https://community.cloudinary.com/ to receive assistance from other members of the community and from Cloudinary's support team. For account-specific questions or if you believe that you've encountered a bug, please contact the Cloudinary team directly via the "submit a request" option on this support site.

Dynamically assign tags using cl_image_upload_tag

Comments

3 comments

  • Avatar
    Admin Tnsfic

    I've played around with this a bit since my original post.  I have a onchange function on my tags field that will get the 'data-form-data' attribute of the direct upload field.  I pluck out and change the tags and then change the 'data-form-data' to include the new tags.

    so, this:

    "tags":"direct_photo_album"

    becomes this:

    "tags":"direct_photo_album, testing"

     

    When I upload the image, only the direct_photo_album tag is being set.  Do I need to set the new tags somewhere else besides in the 'data-form-data' attribute? 

    0
    Comment actions Permalink
  • Avatar
    Curt McCorkle

    Im having trouble with this also. I added the "tags" field to my upload config and the tag does not get added to the uploaded image. 

    0
    Comment actions Permalink
  • Avatar
    Admin Tnsfic

    I ended up getting email support for this issue.  Here's how it was resolved

    "

    Regarding your question, the signature needs to be updated if tags are added.

    This means that you will need to perform an ajax request to get the updated formData.

    You can do (with the latest php library):

    $params = Cloudinary\Uploader::build_upload_params($options);
    $params = Cloudinary::sign_request($params, $options);
    $json = json_encode($params);

    To create the updated form data ($options is the same as you passed to cl_image_upload_tag but with the two tags)

    To update the fileupload widget on the javascript side, you can use $('.cloudinary-fileupload').fileupload({formData: data}) where data is the deserialized json created above."

     

     

    0
    Comment actions Permalink

Post is closed for comments.