• Resolved eyeteeth

    (@eyeteeth)


    hi, i’m wondering if this is possible. i am running a pay-access webcomic gallery, and i want to make sure users can’t easily access images by simply guessing the filename. for instance if the first page is cat-comic-1.png, then the next page is probably cat-comic-2.png, so even if i lock access to the page the image is displayed on they can probably still find it.

    the solution i would like to use is to add a semirandom alphanumeric string to the filename, so cat-comic-2.png could become FOO7BAR3_cat-comic-2.png. i know how to create the string, and it seems like the mfrh_new_filename filter would be able to prepend the string to the filename… but i want to ask if there’s anything that would keep that from working? can i do this with the pro version?

    • This topic was modified 7 years ago by eyeteeth.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter eyeteeth

    (@eyeteeth)

    okay, i ended up trying this. it works! if anyone wants the function, here it is.

    function my_filter_filename( $new, $old, $post ) {
    $rename = substr(md5($new), 0, 8);
    return $rename . ‘_’ . $old;
    }
    add_filter( ‘mfrh_new_filename’, ‘my_filter_filename’, 10, 3 );

    Plugin Author Jordy Meow

    (@tigroumeow)

    Yes, like this it’s good, as long nobody guess how it works exactly ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add hash/random string to beginning of filename’ is closed to new replies.