Jump to content

Help with community system


cordoprod

Recommended Posts

Hello :)

 

I develope a community system and i want the users to be able to upload a personal picture.

 

But, what i want is when they upload it they shouldn't just upload it to a folder e.g images/

 

If the username is cordoprod i want folders like c/o/r/d/cordoprod  .. understand?

 

I also need help when i should view the image.. like what code should i use to get the image source?

 

All help gladly appreciated :)

Link to comment
Share on other sites

You should have one universal images/ folder instead of a bunch of little folders to save disk space and not have a confusing directory tree.  Why do you want all those directories?

 

And you can just do:

echo '<img src="images/' . $imagename . '" />';

 

Assuming that $imagename contains the image name.

Link to comment
Share on other sites

Having nested directories like that is for avoiding problems caused by having to many files in a directory. It is a common way to do that. The apache cache is one example

 

It's not at easy to manage, honestly. >_>  Especially if people will be constantly removing/uploading pictures.

Link to comment
Share on other sites

If the username is cordoprod i want folders like c/o/r/d/cordoprod  .. understand?

 

U want your folders c/o/r/d ??? Thats weird!! Its okay to avoid overfilling one images folder, but u can always have a folder for each user. In such way u can easily find the images (assuming u have db based users) and have a good directory tree.

 

About getting the images source, u should save it in the db and display it in <img> tag.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.