Modify an img html tag's properties?

rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Wed, 2009-08-12 05:25

I'm in the process of writing a module to allow me to draw a rectangle over part of a photo and then map the coordinates to a tag (basically allowing me to tag someone's face). I'm then using HTML map and area tags to set the alt text to the name of the tag and make it clickable.

The issue I'm running into is that in order to tell the web browser to use the map, I need to modify the current theme's views/photo.html.php file like so:

Quote:
<?= $item->resize_img(array("usemap" => "#faces", "id" => "gPhotoId-{$item->id}", "class" => "gResize")) ?>

Would there be any way to have a module insert the additional property without modifying the actual theme code? It doesn't look like there is, but I thought I'd ask, just to be sure.

 
talmdal

Joined: 2006-12-06
Posts: 358
Posted: Wed, 2009-08-12 18:02

Not at the moment. However having said that, what you could do is use the one of the theme->item_xxxxx callbacks to inject some javascript that adds the usemap attribute.

http://www.timalmdal.com

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Wed, 2009-08-12 18:07

Just a question about this modules. Would this be similar to Flickr's notes feature?
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Wed, 2009-08-12 18:21
nivekiam wrote:
Just a question about this modules. Would this be similar to Flickr's notes feature?

I don't know, I've never used flickr. * goes off to investigate *

Edit:
Same basic idea, except you're not assigning a note to it, you're assigning an existing tag. I was aiming for something closer to this request with it:
http://sourceforge.net/apps/trac/gallery/ticket/534

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Wed, 2009-08-12 18:30

Ah, I see. That's cool too. :)
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Wed, 2009-08-12 18:40
talmdal wrote:
Not at the moment. However having said that, what you could do is use the one of the theme->item_xxxxx callbacks to inject some javascript that adds the usemap attribute.

http://www.timalmdal.com

I didn't think of that, thanks :)