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
https://forums.phpfreaks.com/topic/103332-help-with-community-system/
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.

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.