Tagged: fields, image, upload, validation
- This topic has 26 replies, 9 voices, and was last updated 7 years, 2 months ago by
Steve.
-
AuthorPosts
-
-
September 22, 2012 at 4:30 pm #208
pdewoutersMemberHi
I see there’s a basic upload field, but is there a media upload field that loads the default media upload UI with thickbox?
-
September 22, 2012 at 9:24 pm #209
SteveKeymaster@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.
-
September 23, 2012 at 12:18 pm #213
pdewoutersMemberthanks, 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
-
September 23, 2012 at 12:27 pm #214
pdewoutersMemberI 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 -
September 23, 2012 at 5:53 pm #216
SteveKeymaster@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.
-
September 23, 2012 at 7:13 pm #217
pdewoutersMemberthanks, 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 -
September 23, 2012 at 8:41 pm #218
SteveKeymaster@pdewouters– Upload fields do not currently work with Settings. Hope to have it fixed this week.
-
December 10, 2014 at 2:17 am #3017
azizultexMemberHi,
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
-
December 10, 2014 at 4:23 am #3018
azizultexMemberOk. 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
-
December 10, 2014 at 11:52 am #3022
SteveKeymaster@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.
-
December 11, 2014 at 5:48 am #3040
azizultexMemberHi @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!
-
December 11, 2014 at 1:17 pm #3050
SteveKeymaster@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.
-
-
October 5, 2012 at 10:22 am #241
Jason LaneMemberSteve, 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.
-
October 5, 2012 at 12:56 pm #244
SteveKeymaster@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.
-
October 11, 2012 at 9:28 am #261
Jason LaneMember@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.
-
October 11, 2012 at 9:51 am #263
pdewoutersMembercool
I’d love to check it out
-
October 11, 2012 at 10:16 am #264
Jason LaneMemberYou 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.
-
October 11, 2012 at 10:36 am #265
SteveKeymaster@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.
-
October 11, 2012 at 12:04 pm #268
James McMember@jason_lane- Thank you for sharing this!
-
October 11, 2012 at 9:24 pm #274
Jason LaneMemberHi 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.
-
October 14, 2012 at 11:39 pm #281
James McMember@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…
-
October 16, 2012 at 6:24 pm #301
Jason LaneMemberOops. Thanks for pointing that out.
-
October 17, 2012 at 1:59 am #302
KevinKeymaster@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
-
November 19, 2012 at 12:06 pm #432
ronstrilaeffMemberHi 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 -
November 20, 2012 at 6:20 pm #443
persMember@jason_lane excellent work!
Any technical reason why you’ve disabled auto updates?
-
November 20, 2012 at 9:49 pm #445
Jason LaneMemberIt’s just something I do out of habit whenever I write a custom plugin that won’t be added to the WP Plugins repository.
-
December 6, 2012 at 5:02 pm #521
jchambMember@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.
-
-
AuthorPosts
- You must be logged in to reply to this topic.