Helping you Build Your Own Social Network!

Faster, better and easier!

BP-Gallery: Bulk Upload Photos without Flash

(4 posts) (2 voices)

Tags:

No tags yet.


  1. The ability to upload photos is a main feature of bp-gallery. Can someone explain to me why Flash is a necessary element to bulk upload photos? I've turned off the Flash uploader and uploading a single file works, minus the ability to upload multiple photos with ajax.

    I can see that j("#bulk_upload_media_submit").live('click',function() {
    in theme.js is only setup to handle flash...
    There are no ajax calls in this function.
    I tried copying the function from j("#gallery_save_from_web").live("click",function(){
    to duplicate what it does, (i've changed the actions and the necessary ids), but then i get errors from bp_gallery_ajax_save_gallery_media, which is reporting that the file i'm uploading has no size. This can't be the case because I can upload the photo without ajax and without flash enabled.

    Why can I bulk embed videos without flash from add from web, but not be able to bulk upload photos without flash? I've dug into the code and I see that functions have been half-written for this feature.

    Has anyone successfully modified the code or figured out a way to get bulk upload of photos with ajax working?

    Below is what I got so far, but like I said it's producing errors from bp_gallery_ajax_save_gallery_media: {"error":{"msg":"This file type is not allowed in current gallery. You must upload a file which is jpg, jpeg, png, gif"}}

    I know in this case gallery_web_url is doing nothing but I haven't removed it yet. Any help would be appreciated!!

    /**
    * @desc Bulk Media Upload Handling
    */
    j("#bulk_upload_media_submit").live('click',function() {

    if(helper.is_flash_enabled()){
    populate_post_params_for_media();//populate the post parameters
    guploader.swfupload('startUpload');
    return false;
    }

    j(".guploading").show();//show loading icon
    var web_link=j("#gallery_web_url").val();

    var gid=j("#galleries-list").val();
    var media_status=j("#gallery_status").val();
    var nonce=j("#_wpnonce-save-gallery-image").val();
    j("#bulk_upload_media_submit").attr('enabled','enabled');
    j.post( ajaxurl, {
    action: 'save_gallery_media_bulk',
    'url':web_link,
    'cookie': encodeURIComponent(document.cookie),
    'gallery_id':gid,
    'media_status':media_status,
    '_wpnonce': nonce
    },
    function(response){
    //alert("result");
    alert(response);
    return false;
    //show response
    j("#update_media_upload").prepend(response);
    j(".guploading").hide();//hide loading icon
    j("#bulk_upload_media_submit").attr("enabled",'');
    j("#gallery_web_url").val('');
    });

    return false;

    });

    Posted 5 months ago #
  2. Hi Scott,
    The problem with almost all multi file uploaders which are compatible with most of the browsers(yes, that includes IE) needs Flash.

    The html5 based uploader can be a better solution but the support for old IE browsers are a major hurdle. and If you use only javascvript(iframe based uploader) they do not provide the status of current uploading(like 30% uploaded or so).

    While developing BP gallery, I had tried almost all major solutions available(uploadify, swfupload,Plupload) but could not find an uploader which worked for all brwosers(except that swfupload did work).

    So finally settled with it.

    If you see, I have put the code for uploading in Gallery folder(in theme) to allow you plug in your own uploader. Though It will require some effort to replace the uploader with another one.

    Posted 5 months ago #
  3. Brajesh, thanks for the detailed update. I understand the need to address compatibility. Let me ask you...

    Right now what's happening is that after submitting the upload form the browser reloads and defaults to the "add from web" tab. What I'd like to happen is that after submission the page reloads, staying on the upload tab and then display the last photo uploaded. It doesn't make sense to submit the form and then get sent to the add from web tab... Is there somewhere that sets that as the default?

    Is there a method, without using flash, by which I can change what's happening upon submission? to just reload the upload tab and show the last photo uploaded?

    Thanks so much.

    Posted 5 months ago #
  4. I believe I figured it out. Thanks.
    If anyone else stumbles across this post and you want to achieve the above desired result, you can try the following. Worked for me anyway. If you don't want flash enabled on upload and you don't care about being able to bulk upload, but you want your user to have a decent user experience, then on upload-form.php, under the form info, you can place the following code and it will essentially show you the last photo you uploaded. This at least lets the user know their upload was successful without having to leave the screen/page to check if the file was uploaded...

    <div class="update_media_upload" id="update_media_upload">
    <?php if(bp_gallery_has_medias("per_page=1")): ?>
    <?php while(bp_gallery_medias()):bp_gallery_the_media() ;?>
    <?php bp_media_html();?>
    <?php endwhile; ?>
    <?php endif; ?>
    </div>
    Posted 5 months ago #

Reply

You must log in to post.