for me it was important to save the pictures in a folder-based tree structure like you do in Windows/Linux e.g.
Actually the structure is "PhocaGallery-ROOT/aliasname-aliasfolder-timestamp", so every new folder is saved in the phocagallery-root and there is no other relationship to the main category.
The new structure should be "PhocaGallery-ROOT/MainCategory/Subcategory/...".
I also have changed the default access-rights, which are set when a user is creating a new category. What i have with this changes, is a better usage for cloud-systems. Every user, that has access to the menu, can create new folders and everyone can upload images into it, without any admin maintenance.
I have implement it by my own; sure that there is a better way to to it, but my way works perfectly.
What have i changed?
.../components/com_phocagallery/controllers/category.php
Search for:
Code: Select all
$userFolder = PhocaGalleryText::getAliasName($user->username) .'-'.substr($post['aliasfolder'], 0, 10) .'-'. substr(md5(uniqid(time())), 0, 4);
Code: Select all
// $userFolder = PhocaGalleryText::getAliasName($user->username) .'-'.substr($post['aliasfolder'], 0, 10) .'-'. substr(md5(uniqid(time())), 0, 4);
Code: Select all
// new creation of folders, to implement a folder-based saving with tree-structure (like in windows e.g.)
$db = JFactory::getDbo(); // DB-Connection
define( "DATA", "#__phocagallery_categories" ); // Define a short key "DATA" for table "__phocagallery_categories"
$query = $db->getQuery( true ); // New object
$query // Define query
->select( '*' )
->from( $db->quoteName(DATA) )
->where( $db->quoteName('id') . " = " . $db->quote( $catid ) ); // search the row with "id == catid"
$db->setQuery( $query ); // execute the query
$row = $db->loadRow(); // save the result in $row
$path = $row[24]; // on pos. 25 is saved the "userfolder", which is the path to the categorie (webspace)
$userFolder = $path . '/' . substr($post['aliasfolder'], 0, 40); // save the path with a "/" and the aliasname (up to 40 character) of the new folder/categorie.
// New syntax: "PhocaGallery_ROOT/FirstCategorie/FirstSubcategorie/..."
// end of new creation of folders, to implement a folder-based saving with tree-structure (like in windows e.g.)
Explanations are added as comments.
For new folders i also use the aliasname (with up to 40 character) of the folder, so german umlaute or other special character will be eliminated to ensure that there are no problems with.
If you also want to change the default rights for new folders, which was created by users, than go down to
Code: Select all
$post['uploaduserid']
It should be
Code: Select all
$post['uploaduserid'] = "-1";
All the best,
Christian