hey, i've got a profilesystem on my website, now i want to add a gallery for all registered members (my whole website works with the phpbb system). i want to use CKFinder to let them upload/delete their photo's!
Example:
Website: http://domain.nl
Storage for Profiles: http://domain.nl/profiles/
with every user that opens a profile i want to make a folder within profiles with their userid (example http://domain.nl/profiles/2/ )
i only want them to upload pictures (no flash/other files) in the base map (no need for subfolder images/)
my question is, how can i make this work? my mind is spinning
Tue, 09/23/2008 - 20:59
#1
Re: How to use with membersgallery
Well you must have some programming knowledge to do this I guess.
AFAIK, phpBB stores user id in $user->data['user_id'], so you must use this variable when constructing user's directory and when authenticating.
I tried to setup the easiest example for you, here's the result:
I've unpacked CKFidner inside of phpBB directory.
Inside config.php of CKFinder I borrowed a couple of lines of code from phpBB to authenticate user inside of CKFinder based on phpBB's user data.
(I'm not sure if this check is safe enough though, I don't know phpBB code that much)
I've set helper variable $baseUrl to '/profiles/', because we want to store files there:
Last thing to do was to configure CKFinder directory.
I have removed all resource types other than Images, and adjusted path to Images resource type:
Note that url and directory are based on $user->data['user_id'].
Now all you have to do now is to look at CKFinder javascript samples and inject CKFinder code into phpBB. When you make it, it would be great if you could create a MOD in MODx format and make it available for other users.
Below is the simplest MOD (in old format) for phpBB 3.0.2 that just adds "Browse Server" inside of user's profile.
Note that you have to delete cached files after you change phpBB templates.
With the code above, users should be able to upload files to their own directories when they vist their profile. The only thing that has left is to display somehow images they have uploaded.
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Re: How to use with membersgallery
many thanks for helping me out, gonna give it a go now!
(using scripts within the phpbb pages, so it has to be always fresh
)
i know about the cache, turned that off
if it's gonna work i will put a MOD in the database here! (as thanks for helping me out!)
and about the problem of showing visitors the pictures they've uploaded i think i already have something..
anyways i'm gonna work this out now, could take some while, but i'll let you guys know if it's gonna work!!
Re: How to use with membersgallery
it's acting real strange, i've did it like you said but he makes a strange folder
it puts the files in:
http://domain.nl/ck/profielen/2/test.jpg
in the fc editor it's put's out the right url when you click view file! ( http://domain.nl/profielen/2/test.jpg )
so i think if we can solve this problem it could work! it's strange he picks the /ck/subfolder because the original CKFinder software is in the folder /ckfinder/ so i guess it's not a problem i caused?!
hoping for help!
edit:
tryed it on another directory on my host, doing almost the same..
http://sub.domain.nl/c/profielen/2/test.jpg
url is working file on editor
http://sub.domain.nl/profielen/2/test.jpg
Re: How to use with membersgallery
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Re: How to use with membersgallery
got it working now idd! i've solved it with the basedir/url!
made it like:
$baseUrl = 'http://domain.nl/ckfinder/';
$baseDir = 'c:/domains/domain.nl/wwwroot/ckfinder/';
so that works fine now, also with the $userid folders, but how does it work when i want to set the userid for the editor?
i mean like:
can i make a code like this?:
if this would work, how do i get/read the $finder->userid back in the configfile??
edit:
another question:
is it possible to set an amount of pictures to be uploaded? i want to have a maximum of 12 pictures for each user!
Re: How to use with membersgallery
Could you explain what exactly do you want to achieve because I don't understand what do you mean?
Do you want to use different user_id than user_id that is assigned to currently logged user?
You may try to pass dynamic variables to config.php using sessions... I need more information to help you.
At this moment, the only way to achieve this is to modify CKFinder connector. It's not a very hard task, but try to keep your modifications clean so that you could re-apply them when you update CKFinder in the future (e.g. keep your custom code inside of a function, or comment your changes).
Take a look into core\connector\php\phpX\CommandHandler\FileUpload.php, resource type settings are available here:
you have add code that scans this directory and rejects uploading if directory contains more than 12 files:
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+