Please help! Automatic image url to post's location and automatic file naming

Discussion in 'HTML & Website Design' started by jvyzsy, Aug 19, 2013.

  1. #1
    Hi,

    (If you have a solution to WordPress 3.6, that would be amazing too!)

    1. Question:
    I own a funny picture site and I upload lots of images every day. I would like to add the post's location to every newly uploaded images automatically(as a click-through link).

    So if the new posts address is http://mysite.com/category/new-post , then it adds this url to the picture and if I click on it then I will go to that address. Basically I wouldlike to fill the "Link URL" section automatically.

    I have found this code but I guess I have to alter this in some way but I don't know how. With this code the "Link URL" section will be blank so this is not working for me. Changing "none" to "file" or "post" didn't work either because I got links to the image itself or the attachments address. :/

    -------------------------------------------------------

    $image_set = get_option( 'image_default_link_type' );
    if (!$image_set == 'none') {
    update_option('image_default_link_type', 'none');
    }

    -------------------------------------------------------

    2. Question:

    There are lots of sites where if I upload a picture, the file gets the the post title as the file name. So if I upload "something.jpg" with "Funny meme" title, then if I download it from that site, it will be "funny-meme.jpg" and maybe some numbers after it to avoid duplications. How can I do this automatically?

    Thank you for your help and I hope it is understandable what I would like to do.

    Cheers
     
    jvyzsy, Aug 19, 2013 IP