Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRadha Bhambwani
10,182 PointsHow can I display an image that is stored on my server to my website?
Not sure if I worded the question title right. I'm a beginner and I am trying to create a simple website. I have a registered domain name and I also have a hosting account through hostgator.
I need the website to have the following functionality:
1) User authentication (register for an account, login using username and password)
2) Users may upload pictures from their computer to my server
3) Users may view pictures that they have uploaded
4) Users may view pictures uploaded by other users
5) Users may download pictures uploaded by other users
So far, I have only accomplished task #2 (without user authentication). So to test it out I uploaded 2 pictures to my server/hosting account. I only used html and php to do so. My question is how can I display those images stored on my hosting account's ftp onto my website? Do I need to use mySql in addition to PHP? Or can I go without using mySql?
Any help will be greatly appreciated!
Steve Davis
5,332 PointsRadha,
I think there is an easy way to do this through Wordpress. Check the documentation here: http://codex.wordpress.org/Main_Page. And also check the plug-ins directory here: https://wordpress.org/plugins/, and the Themes directory here: https://wordpress.org/themes/.
I recommend taking the Learning Wordpress Track, and if you are interested in going further, also take the Wordpress Development Track here at Treehouse.
http://teamtreehouse.com/tracks/learn-wordpress
http://teamtreehouse.com/tracks/wordpress-development
For Development Tools, check the Library here at Treehouse:
http://teamtreehouse.com/library/topic:learn-development-tools
The Database Foundations course is here, which I took and I highly recommend.
http://teamtreehouse.com/library/database-foundations
I am interested in databases, and I would like to see more courses in database management, as I think it is very important for a number of reasons, and there should be much more attention and energy devoted to this subject.
This course is also included in the PHP Development track, at the sixth stage of 11 stages in that track.
http://teamtreehouse.com/tracks/php-development
And the course is also included in the tenth stage of 12 stages of the Rails Development Track, located here: http://teamtreehouse.com/tracks/rails-development
MySQL can be installed on your domain. Look at your Cpanel on HostGator. Scroll down to Databases. I see four options under Databases: MySQL® Databases, MySQL® Database Wizard, phpMyAdmin, Remote MySQL.
I installed my own WordPress site on my domain, http://healinglight.info. HostGator is great, by the way! Great choice! I have had them as my hosting company for the past few years, and they have been great, no problems at all.
If you have a business account with them, you can get a free SSL certificate. I am doing that, for my Ecommerce and LMS integrated WordPress site, which is in currently in development by me, and I will launch it soon, at the same domain listed above.
Best regards, and please let me know how you resolve your requirements for your functions and questions.
Steve
Marcus Parsons
15,719 PointsOne of the things not covered here is the security of MySQL. You will also need to learn how to protect yourself from attacks such as SQL Injection, where a user can insert SQL commands into your database to gain administrator level access to the database. I could be wrong, but I don't think there are any courses offered on Treehouse currently for dealing with SQL Security. There are, however, a ton of resources on the web you can find that deal with protecting your data using MySQL.
Steve Davis
5,332 PointsMarcus, Good point.
WordPress has very good security recommendations, including recommendations on how to prevent SQL injection attacks.
Please see this link:
http://codex.wordpress.org/Hardening_WordPress
and this one:
http://codex.wordpress.org/Backing_Up_Your_Database
Steve
2 Answers
Radha Bhambwani
10,182 PointsThanks everyone for your input! Ben, I'm glad you told me what courses are relevant on teamtreehouse. I did a little bit of Database foundations course a month ago but never ended up finishing but will continue with that course now. Steve, I didn't know much about wordpress before but now I do. However, I don't intend on using wordpress for now because it sounds more like a framework and I'm trying to build a website from scratch and get a better handle on programming. But thanks for the tips!
Steve Davis
5,332 PointsRadha, Sure, no problem. Please post your solution here.
Ben Attenborough
Front End Web Development Techdegree Graduate 32,769 PointsBen Attenborough
Front End Web Development Techdegree Graduate 32,769 PointsAlthough there may be a way to display the pictures stored in a specific directory without using mySQL it will be very hard to do the other elements you want without using it. I'd recommend the php development track http://teamtreehouse.com/tracks/php-development and in particular the database foundations course http://teamtreehouse.com/library/database-foundations followed by the using mySQL with PHP module http://teamtreehouse.com/library/using-php-with-mysql
It takes some setting up and you will need to check that your hosting account allows databases but it's the best way to do the things you want. You need to be able to store user generated information and to have that information persist after the session is over. You could create a document on the server and store the information there, but it would be hard to manage and insecure, a database is a better solution.