PDA

View Full Version : Best way to implement a rating system for website images?


TripperTreats
10-18-2006, 08:50 AM
Hello, thanks in advance for any help!

I make and sell digital art on my website, and I want to do what my title suggests. Ideally, upon entering the appropriate page, a user would see a random image, and if they chose to rate it, they could, and then more would appear for them to rate (similar to what NetFlix does). My question, then, is what is the best approach for this?

I am familiar with Javascript and PHP, and willing to learn whatever else is necessary. Should I research cookies, more PHP, etc.? Obviously, I want the user's ratings to show up the next time they visit the site. If cookies are the answer, isn't there a mass trepidation to accepting them on the part of visitors? Any alternatives to cookies if they are the best bet here?

Thanks again for your time,
Jason Duvall
www.trippertreats.com

mlseim
10-18-2006, 02:48 PM
You're going to need a database of some kind to keep track.

Since you mentioned learning PHP, I assume you're not using a PHP/MySQL
script for your gallery. The rating will be attached to each photo? That
means you need to save the ratings in some sort of file.

Tell us more about how your existing site is developed. Are the pages all
static, or do you have a script running the gallery and ecommerce part?

.... and give us a link so we can see it. That helps the most.
oh ... I guess it's: trippertreats.com ?

TripperTreats
10-18-2006, 03:22 PM
Thanks for your reply!
It is indeed www.trippertreats.com (http://www.trippertreats.com).

OK...I am not using a MySQL database, although I've heard about that in many contexts, so it must be important!

Next, the actual gallery of my website, www.trippertreats.com/PhotoGallery/gallery.html (http://www.trippertreats.com/PhotoGallery/gallery.html), is completely generated automatically with an image gallery-generating software program called JAlbum, although I have the ability to customize its "skin" to implement my rating system using PHP.

As to the rest of the site, PayPal handles all the ecommerce, but in order for a user to select his desired image on my site at www.trippertreats.com/Products.php (http://www.trippertreats.com/Products.php), I call up a list of thumbnails of all my artwork with a script like:

--------------------------------------------
<?php $handle = opendir('Photo Gallery/thumbs');
while (false !== ($file = readdir($handle))) {
if (substr($file,-4) == ".jpg")
$files[] = substr($file,0,-4);
};
sort($files);
closedir($handle);
foreach ($files as $key => $imageName) {
....
---------------------------------------------

Thus, I use PHP to iterate through my images directory to display each of them. I guess the code for my rating system would use something similar since this snippet of code is simple and effective. Manually reprogramming the JAlbum skin would be a much more monumental, but necessary, task.

OK, MySQL sounds like it needs some research. I hope this information is what you were looking for! Let me know if I need to supplement it with more details. Thanks again for the prompt, expert advice.

mlseim
10-18-2006, 05:47 PM
You actually might not need MySQL. It could be done with a flat-file
database (text file). Your first step is determining where you are going
to display random image(s) that people can rate. For sure, that page needs
to have the extension of .php (instead of .html).

Once they rate it (on some kind of numeric scale?) the data is stored in the
flat-file database.

Now, you determine where the ratings should appear ... in the gallery? or
in the products section? The Products.php page is already PHP, so that
might be a possibility. The gallery is generated by JAlbum, so if that's PHP,
it could be a possibility. In either case, as each photo is displayed, an array
needs to be scanned to find the photo's rating (the array would be loaded
from the flat-file database (text file).

To be honest, I'm not sure how accurate (or valuable) a rating really is.
If enough people rate it honestly, that might be of use. But if someone
just goes in and rates an image 100 times, how accurate is that?

Although a nice project to do as a PHP learning experience, I don't think it's
really worth the effort. I would be more inclined to spend the time to allow
a person to add an image to the cart directly from the Gallery and eliminate
the Products.php page.

And when I last looked, the Gallery is not working ... can't open a full-size
image. So this brings me to another solution ....

Download a free shopping cart (cubecart.com), or purchase a nice one like
X-Cart and find a webhost that allows PHP/MySQL. Do your whole site
with the shopping cart script. It becomes the gallery, and handles all of the
purchasing automatically. X-Cart has item ratings, email to a friend, most
popular items, featured items....

Most importantly, the shopping cart scripts can be configured to handle
files instead of tangible items. That means I could purchase an image from
you with your shopping cart, pay for it with my credit card, and the image
would be available for me to download only after I paid. All of the invoices,
etc. are handled by the script.

That's where I would go with your site if it were me.

But, for learning PHP, go ahead with your ratings plan ... it will be a
good experience.

TripperTreats
10-18-2006, 06:14 PM
You must have viewed my site during the five minute period when I was updating it after submitting my last post! I was hoping that wouldn't happen.:)

I would make the ratings universal and appear under an image everywhere it happens to be on my website. And you're right, I don't want people rating an image multiple times, but that's why I was thinking about cookies, so that someone can rate an image once and only once.

My idea was that a rating system would draw people's attention to particular pieces and make them more inclined to buy SOMETHING, especially if they see that 58 people have rated this picture as "awesome".

Several people have told me to get rid of the products page...I can't tell you how much time I have spent developing that page! The other ones were easy compared to it. I agree, though. Hmmmm, I'll consider that.

Your shopping cart idea seems like a great one. I didn't realize there were programs out there that completely handle what I'm trying to do. I just started making art and got into web developing, so my idea was to do it single-handedly. But it's been a wonderful, productive learning experience, so even if I replaced it with a completely automated shopping cart package, I'm sure I could still find a venue for web developing.

Finally, I've thought a lot about selling my prints as downloads. I might be overly paranoid, but I'm trying to completely avoid digital copies of my work to prevent copyright infringement. If I only sell physical prints, my idea was that everyone who wanted one would have to buy it from me. I purposely post dulled copies as well as copy protection scripts to deter downloading them for free. But then again, there might be many people out there who won't buy from me if they have to wait a week to get a print, whereas they could download it immediately and print it out themselves.... I wonder how many people have photo quality printers these days?

Any further thoughts on this would be greatly appreciated. I'll take a look at cubecart.com and see about overhauling my website. :) So much to think about....