Photopress – upload with directory
-
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.
- The topic ‘Photopress – upload with directory’ is closed to new replies.