How to append _thumb to all media uploaded and media that is already uploaded to my wordpress blog

I was hoping to get some help on this one. I am looking to have appended to all images and media that get applied to a post via the upload tool in WordPress _thumb to the src of the media object.

Thanks,

Read More

Matt

Related posts

Leave a Reply

2 comments

  1. Assuming you are trying to do this on the front-end, a simple solution would be something like the following:

    Assuming something like:

      <img src='image1.png'>
      <img src='image2.png'>
    

    jQuery as follows:

    var $allImages = $('img');
    
    $allImages.each( function() {
        var curUrl = $(this).attr('src');
        var newUrl = '_thumbs/' + curUrl;
        $(this).attr('src',newUrl);
    })
    

    Would result in the following HTML:

     <img src='thumbs_/image1.png'>
     <img src='thumbs_/image2.png'>
    

    And finally a working example at jsfiddle – http://jsfiddle.net/BTRax/7/

    If you were trying to do this on the backend in PHP well then someone else will need to chime in 🙂