• Hi all

    I have written a small codes to allow specifying of directory when you upload image. Add following 2 pieces of code to photopress/upload.php

    #1. At around line 170, after imagedesc paragraph, insert this.


    <!-- wk: add category support -->

    <label for="imgdesc"><?php _e('Category:') ?></label>
    <select name="imgcat">
    <option value="default">Default</option>
    <?
    $pp_categories = pp_list_cats();
    foreach ($pp_categories as $pp_cat) {
    $pp_cat_images = pp_cat_images($pp_cat);
    echo "<option value='" . stripslashes($pp_cat) . "'>" . stripslashes($pp_cat) . "</option>";
    }
    ?>
    </select>
    <!-- --------------------- -->

    #2. At around line 320, after $fullsize_code = htmlspecialchars( $fullsize_code );, insert this


    // -- wk: check in to db --
    $name_underscored = preg_replace("/./","_",$img1_name);
    $pp_cats = array($name_underscored => htmlentities2($_POST['imgcat']));

    if (get_option('pp_album_cats')) {
    $pp_old_cats = get_option('pp_album_cats');
    $pp_cats = array_merge($pp_old_cats, $pp_cats);
    }

    add_option('pp_album_cats');
    update_option('pp_album_cats', $pp_cats);
    // -- ------------------ --

    And you are done.

Viewing 1 replies (of 1 total)
  • This looks like a helpful piece of code. Thanks! 🙂

    I have avoided using PhotoPress because of the way categories are assigned, the real problem with deleting images, and the limited options in the upload/browser windows.

    I like it’s photo album and random photo options (a little more control over these would be nice), and especially it having admin controls. The above code for assigning categories seems a better option than having to go to another admin tab in order to assign them. Being able to change categories are good, but when I tried it many months ago I remember having problems with empty categories on the album page when I tried to change the name of the category I wanted a photo in. There was apparently no reasonable way to delete the now unwanted category and it stood out like a sore thumb on the album page.

    Oh! How great it would be if someone could combine the good parts of photopress with the extended options of the Iimage Browser plugin. I like how it actually sees every image you have in the assigned folder. How it allows you to choose the size of the thumbnail (maybe it could be a 3rd option for a blog post while it still creates a standard thumbnail for the album pages). I like how it lets you create an actual subfolder for organizing folders – can’t that be made to replace the mysteriously created “categories” in PhotoPress, which could pull out the name of the folder for album categories? It’s really great how you can delete images and/or thumbnails from the actual server right in the browser window. I also particularly like that you can upload & delete images, and/or create or change the name of a subfolder through ftp and the Iimage browser just picks up the changes (of course one would then have to risk breaking links to images within such a folder, but I’m ok with that).

    I suspect there might be some difficulties with combining all of those options, maybe when it came to viewing the album pages? But couldn’t something close to that be done without dealing with a third-party application like Gallery?

Viewing 1 replies (of 1 total)
  • The topic ‘Photopress – upload with directory’ is closed to new replies.