Home » Topics » Pods 1.x » Add Thumbnail Preview to jqmWindow file-browser for image files
Add Thumbnail Preview to jqmWindow file-browser for image files
Tagged: UGG Knit Cardy Boots
This topic contains 2 replies, has 2 voices, and was last updated by sc0ttkclark 8 months ago.
-
AuthorPosts
-
February 8, 2012 at 10:21 pm #167433
Thought this might be of interest…
When File-Upload column types are used predominantly for images,
it bugged me that when using the jqmWindow file-browser it was often
difficult to find and select the desired image file in the absence of
good, self-explanatory image filenames.To overcome this, I’ve added a little preview DIV just to the right of the
jqmWindow DIV which displays a thumbnail preview for image type files
onmouseover of the image filenames in the filebox.
The caveat however, is that it requires modification of 4 core pods files,
- pods/ui/ajax/misc.php
- pods/ui/js/pods.ui.js
- pods/ui/input_form.php
- pods/ui/style.css
Of course this means that unless Scott decides to incorporate this, you’ll lose the preview upon updating pods.
Mods as follows:
In – pods/ui/ajax/misc.php
Replace…
12345if (0 < mysql_num_rows($result)) {while ($row = mysql_fetch_assoc($result)) {$guid = substr($row['guid'], strrpos($row['guid'], '/') + 1);?><div class="file_match" rel="<?php echo $row['id']; ?>"><?php echo $guid; ?></div>with…
1234567891011121314151617$file_types = array(".jpg",".gif",".png",".jpeg");$thmb_width = get_option('thumbnail_size_w');$thmb_height = get_option('thumbnail_size_h');$thmb_size = "-{$thmb_width}x{$thmb_height}";if (0 < mysql_num_rows($result)) {while ($row = mysql_fetch_assoc($result)) {$hover ="";$guid = substr($row['guid'], strrpos($row['guid'], '/') + 1);$thumb = wp_get_attachment_thumb_url($row['id']);$ext = ".".substr(strrchr($thumb, "."), 1);if(in_array($ext,$file_types)){ $url = $thumb;$hover = 'onmouseover="swf_preview(this.title)" onmouseout="swf_hide();"';}else $url = "file";?><div class="file_match" rel="<?php echo $row['id']; ?>" style="width: 280px; cursor:pointer;" title="<?php echo $url ?>" <?php echo $hover; ?> ><?php echo $guid; ?></div>In – pods/ui/js/pods.ui.js
ADD
123456function swf_preview(src){jQuery(".fb_preview").css("background-image","url('"+src+"')").show();}function swf_hide(){jQuery(".fb_preview").css("background-image","url('')").hide();}In – pods/ui/input_form.php
ADD…
AFTER… < div class="filebox">< /div>’ IN < div class="jqmWindow" id="dialog">
In – pods/ui/style.css
ADD
12345678910111213/* pods swf_upload filebox preview*/.fb_preview {display:none;width: 154px;height:137px;background: #e4f2fd;background-repeat: no-repeat;background-position: center;border:2px solid #c6d9e9;position:absolute;left:300px;top:-15px;}And there you have it. A nice little thumbnail preview when mousing over your image filenames in the jqmWindow filebox. Now… maybe somebody can see a way to reformulate this as a package, but that’s well above my pay grade!
February 9, 2012 at 2:57 pm #167434You know what, Pods 2.0 has a completely revamped Media Library integration with a much better browser and interface —– BUT —– This would actually make a great addition to the existing interface with minimal work on my part to incorporate since you’ve done the hard work of actually doing it for me
I’ll patch this into the next release as an enhancement, thanks for your contribution to Pods core and keep it up – patches are always welcome around here and your help is invaluable to the project’s health. I encourage everyone else to make leaps like this, I’m more than likely going to include it if it makes sense and is minimally invasive to the codebase for 1.x (focusing more on 2.0, if you want to patch that then go at it too!)
September 15, 2012 at 5:01 pm #168295This will finally go into Pods 1.14.4, sorry for the wait, been so busy with getting Pods 2.0 to go out next week
-
AuthorPosts
You must be logged in to reply to this topic.