1

do anyone know a plugin OR override to show the image url immediately after upload - in the media uploader (so not via post/ page-upload) ?

Now it's like -> upload -> edit -> right side is the url I would like to skip the -> edit-click. Sometimes I just upload images to use the url in Widgets/ Custom fields...

Thanks in advance.

  • It's fairly simple to know the URL ahead of time, if you are aware of the year, month and file name components that are used to create it. The various reduced size images are likewise predictable. – jdm2112 Jul 28 '14 at 21:44
1

Here's a heinous hack that replaces the title of uploaded images with the url (constructed by chopping the "-150x150" affix from the pinkynail):

function wpse156087_admin_footer_media_new_php() {
?>
<script type="text/javascript">
jQuery(document).ready(function() {
    (function ($) {
        uploader.bind('UploadComplete', function() {
            setTimeout(function() {
                $('#media-items .media-item').each(function () {
                    var img_src = $('img', this).prop('src');
                    if (img_src.indexOf('/wp-content/uploads/') > 0) {
                        $('.filename.new .title', this).html(img_src.replace(/-150x150(\.[^.]+)$/, '$1'));
                    }
                });
            }, 100);
        });
    })(jQuery);
});
</script>
<?php
}
add_action( 'admin_footer-media-new.php', 'wpse156087_admin_footer_media_new_php' );
  • Not really. Getting an error like: Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'wpse156087_admin_footer_media_new_php' not found or invalid function name in /www/htdocs/w0121345/DEV/play/wp-includes/plugin.php on line 470 – BrainBUG Aug 22 '14 at 13:42
  • I just put your code in themes/active-theme/functions.php AND tried to use the script in a new 'admin_footer-media-new.php' also in themes-DIR. No good result. Any tip? – BrainBUG Aug 22 '14 at 13:53
  • Just copy & paste the code as is into your "functions.php". Remove any other pastings. All it will do is replace the title of an uploaded image in the Upload New Media items list with the url. – bonger Aug 22 '14 at 14:02
  • nope - sorry - nothing. I also changed da theme... put ur code as it is into "functions.php" - nothing changed, but the output error is gone (wonder) – BrainBUG Aug 23 '14 at 16:43
  • Don't know what the issue could be, "works for me". Just to be clear this is in WP 3.9.2, "wp-admin/media-new.php" using the multi-file uploader, and the title of uploaded items listed below the "Maximum upload file size" should change to the url. – bonger Aug 23 '14 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.