Viewing 21 reply threads
  • Author
    Posts
    • #208
      pdewouters
      Member

      Hi

      I see there’s a basic upload field, but is there a media upload field that loads the default media upload UI with thickbox?

    • #209
      Steve
      Keymaster

      @pdewouters– It’s actually the same field, and we actually got it working. You can see the commented out code in file.php.

      However…

      Piklist requires advanced treatment of upload fields. Adding custom meta, associating it with other content, etc., which thickbox makes a bit difficult. We are working on a solution, and also waiting for 3.5 beta 1, to see how this ticket works out, and how we can work with the changes.

    • #213
      pdewouters
      Member

      thanks, but the upload field doesn’t seem to work. I enabled the Demo custom post type and uploaded a file and saved.
      the text next to the upload button still says “no file chosen”
      the status and title also fail to update with the new values.

      PS : there are still some console.log calls in the javascript

    • #214
      pdewouters
      Member

      I had a look at the database entries in the post meta table and:
      correction, it does upload the file, but still shows “no file chosen” after clicking update even though the post meta entry exists

    • #216
      Steve
      Keymaster

      @pdewouters– It works, but we’re still working out the UI. Take a look at this file from trunk… you can even replace it in your install. I added a loop to pull all files uploaded.

      Not a full solution, but it should definitely help. We’re using it with some clients and they love it.

      Let me know what you think.

    • #217
      pdewouters
      Member

      thanks, I’ll give it a go. Do you know if it’ll work on a settings page?
      I just need a repeating group of fields (image/title/desc) for a slideshow
      this is what I have:
      http://pastebin.com/kf1w6Bti

    • #218
      Steve
      Keymaster

      @pdewouters– Upload fields do not currently work with Settings. Hope to have it fixed this week.

      • #3017
        azizultex
        Member

        Hi,
        Thanks for this excellent Framework. I have started using this powerful tool. But I need a little help with media upload on the setting page. Is it fixed yet?

        Here is what I am using to the logo of the site, but it always shows 20.

        <?php
        				  $theme_options = get_option('my_theme_settings');
        				 
        				  $logo = $theme_options['dsffsdfsd'];
        				 
        				?>
        				
        				<img src="<?php echo $logo; ?>" />

        Could you help me how to get uploaded image link?

        Thanks

      • #3018
        azizultex
        Member

        Ok. I got the solution. I have to use echo '<img src="' . wp_get_attachment_url($image_id) . '"/>';
        but upload field allow us to add more images. Since I want to use it to upload logo, it should allow only a single upload.

        How do I do that?

        Thanks

      • #3022
        Steve
        Keymaster

        @azizultex– You can limit the amount of images uploaded by using the limit validation rule:

        'validate' => array(
          array(
            'type' => 'limit'
            ,'options' => array(
              'min' => 1
              ,'max' => 1
            )
          )
        )
        

        Piklist Validation rules are server-side for security reasons. So the user can try to upload multiple images, but once they press save, Piklist will show them an error message. You should probably let users know to only upload one image in your field description.

        Let us know if this works for you.

      • #3040
        azizultex
        Member

        Hi @Steve, Thanks for your reply. that’s rad, but would be great if it didn’t allow to select multiple images instead of sever side validation.

        However, Piklist is a tool that I dreamt. A powerful wordpress framework undoubtedly.

        Thanks a lot!

      • #3050
        Steve
        Keymaster

        @azizultex– this feature is on our list of todos. Glad Piklist made your dreams come true!

        If you have the time, please let the world know how much you love Piklist and leave a review on WordPress.org.

    • #241
      Jason Lane
      Member

      Steve, how is the media upload field coming along? I have a custom media upload field plugin (based on bits and pieces I found on the web) that I developed for my own use. I wrote it in such a way that makes it easy to add an upload field (clickable thumbnail) to any meta box or settings page. It could probably be adapted into Piklist pretty easily, and I’d be happy to send you my code if it might help.

      EDIT: Forgot to mention that my plugin utilizes the default WP uploading thickbox window.

    • #244
      Steve
      Keymaster

      @jason_lane– Media upload works well for Post Meta, still working on getting Settings right. We have code for uploader, and we’re just discussing UI and also changes in WordPress 3.5.

    • #261
      Jason Lane
      Member

      @pdewouters – If you’re interested, I’ve just finished writing an add-on plugin for Piklist, adding an image field that uses the WP media upload UI. It works on Settings pages and also as add_more fields. The plugin works without modifying any of Piklist’s core code.

    • #263
      pdewouters
      Member

      cool

      I’d love to check it out

    • #264
      Jason Lane
      Member

      You can download v1.0 here.

      Create your fields as normal, with just a few changes. eg:

      piklist( 'field', array(
      'field' => 'field_name',
      'label' => 'Field Label',
      'type' => 'image', // This is a new field type added by the plugin
      'options' => array()
      ));

      The ‘options’ array can contain any of the following options:

      link_text : Set custom text for the link. Default: ‘Click to insert an image’

      thumbnail_size : Specify a thumbnail size to display the image in the back end. Can be a registered image size or an array of dimensions (width, height). Default: ‘thumbnail’

      save_as_url : Defaults to false, and the image ID is saved as the field value. Set to true to save the image URL instead.

      placeholder_image_src : You can specify the URL of an image to display when none is selected.

    • #265
      Steve
      Keymaster

      @jason_lane– This is awesome! Good job with the Piklist plugin.

      You’ve shown just how easy it is to extend Piklist and add a new field type.

      Just an FYI: we are working on the media upload UI, but need to support attachment meta as well.

    • #268
      James Mc
      Member

      @jason_lane- Thank you for sharing this!

    • #274
      Jason Lane
      Member

      Hi Steve, thanks for the compliment, and thanks for providing such a good framework to build upon.

      BTW, I know you guys are working on your own media upload UI, but you mentioned you’re also discussing changes coming with WP 3.5, so I’m guessing that might hold up your version. I just figured I’d put my own version together, since I already had most of the code written. I haven’t looked at WP 3.5 yet, so I don’t even know if this plugin will work when that comes out.

      As far as meta data goes, I find that storing the image ID is sufficient for all my needs, since I can always grab meta data based on the ID if I need it.

    • #281
      James Mc
      Member

      @jason_lane: small bug/typo in your javascript file

      $('#piklist-field-add-more-add-button').unbind('click').click(function(event) {
      event.preventDefault();
      // alert();

      You forgot to provide the event argument in the function…

    • #301
      Jason Lane
      Member

      Oops. Thanks for pointing that out.

    • #302
      Kevin
      Keymaster

      @jason_lane-

      Thanks for the fantastic idea and implementation. We are working on the upload field in great detail this week and will be taking some notes from your code and suggestions.

      Thanks for your work!

      Kevin

    • #432
      ronstrilaeff
      Member

      Hi Steve and Kevin (and all)

      I just watched your WC-NYC presentation about Piklist, and am hoping I can use it to do the following:

      I need something now that lets my users and preview and “approve” a custom post type they created with various meta data including a thumbnail of their creation after it has been cropped (with undo/redo) to their liking before pressing the submit button.

      Their submission will go to pending status where we (the site admins) will schedule it for publication (or give them feedback or a rejection notice if something is wrong).

      So I have downloaded it (and Jason’s plugin) to my sandbox and will invest a few hours to setting it up and see if I get something working primarily on the submit form and image upload. I think I will have to integrate the jcrop js library to do the nice gui part. Any tips are very welcome, since this is something very new.

      Thanks,
      Ron

    • #443
      pers
      Member

      @jason_lane excellent work!

      Any technical reason why you’ve disabled auto updates?

    • #445
      Jason Lane
      Member

      It’s just something I do out of habit whenever I write a custom plugin that won’t be added to the WP Plugins repository.

    • #521
      jchamb
      Member

      @jason_lane I’ve been playing around with the 3.5rcs its pretty easy to get the new media uploader to work with what you already have written.

      line 152 set $classes = ‘piklist-image-field-link insert-media’;
      line 165 set $href= “”; (empty string)
      and then on your img tag (start line 177) also add a class=”insert-media”

      everything else should work fine.

      Two things to note… in my project i have the editor on screen so the necessary javascript for launching the new media browser is already there, so if you don’t have an editor you might nedd to add some scripts… i didn’t really look into that. And secondly if using editors you need to restore the original window.send_to_editor for tiny_mce add media to work.

      right under line 3
      var piklist_image_field_current = {};

      I added
      var send_to_editor_orig; (line 4)

      then right before replacing window.send_to_editor = window.piklist_image_field_send_to_editor; (roughly line 13) add

      send_to_editor_orig = window.send_to_editor;

      then last step is to restore the send to editor after you call tb_remove(); (roughly line 73) so add

      window.send_to_editor = send_to_editor_orig;

      After that everything should work pretty seamlessly.

Viewing 21 reply threads
  • You must be logged in to reply to this topic.