Walker
Walker

Reputation: 134423

"Tagging" users in photos?

I'm trying to code a way for users to "tag" other users in PHP/MySQL.

So far my idea is this:

This seems like a really ugly way of handling the task - anyone have any suggestions for me?

Upvotes: 0

Views: 526

Answers (2)

Jeremy Battle
Jeremy Battle

Reputation: 1638

Have a table called pictures, a table called tags and a table called pictureTags. Picture tag needs id, pictureid, tagid and depending if you plan to highlight a face on hover, x1, width, y1, height to store the coordinates of the persons face in the image. I recommend a jQuery plugin called jCrop if you plan to store the persons face coordinates, it will allow you to easily grab them.

Upvotes: 1

Dolan Antenucci
Dolan Antenucci

Reputation: 15942

If you're looking to do Facebook-style tagging of people in photos (i.e. overlay on top of the photo), try this how-to article:
http://www.bryantan.info/jquery/facebook-like-photo-tagging-using-jquery-and-php/5

If you simply want to have a list of names next to the photo, create a many-to-many linking table. Example:

create table pictures (
    id int auto_increment,
    photo_url varchar(100),
    primary key (id)
);

create table users (
    id int auto_increment,
    photo_url varchar(100),
    primary key (id)
);


create table users_in_photos (
    id int auto_increment,
    photo_id int,
    user_id int,
    primary key (id)
);

Upvotes: 5

Related Questions