cordoprod Posted April 28, 2008 Share Posted April 28, 2008 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 Quote Link to comment Share on other sites More sharing options...
DarkWater Posted April 29, 2008 Share Posted April 29, 2008 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. Quote Link to comment Share on other sites More sharing options...
dptr1988 Posted April 29, 2008 Share Posted April 29, 2008 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 Quote Link to comment Share on other sites More sharing options...
DarkWater Posted April 29, 2008 Share Posted April 29, 2008 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. Quote Link to comment Share on other sites More sharing options...
Fadion Posted April 29, 2008 Share Posted April 29, 2008 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. Quote Link to comment Share on other sites More sharing options...
blackcell Posted April 29, 2008 Share Posted April 29, 2008 I would go with the user-specific directory. eg <?php echo "<image src='images/".$userName."/".$imageName".'/>"; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.