Announcement

  •  » Engine
  •  » pwg.images.addSimple - escape character for commas in tags

#1 2013-02-13 15:11:40

kenl
Member
2013-01-12
91

pwg.images.addSimple - escape character for commas in tags

Hello,

Is there an escape character for commas in tag names when adding photos with addSimple?

For example, I use a tag "Smith, John" I add a photo, with the tag, to piwigo using addSimple.  When viewing the photo, it is tagged 2 times with "Smith" and "John".

I've tried sending the tag as:
     Smith, John
     "Smith, John"

Is there a way to 'escape' the comma character?

Thanks,
Ken

Offline

 

#2 2013-02-13 15:24:14

flop25
Piwigo Team
2006-07-06
7037

Re: pwg.images.addSimple - escape character for commas in tags

Hello
it seems no
"$tag_names = explode(',', $params['tags']);" :/
So I open a ticket in our bugtracker


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#3 2013-02-13 16:05:32

kenl
Member
2013-01-12
91

Re: pwg.images.addSimple - escape character for commas in tags

Thank you.

Ken

Offline

 

#4 2013-02-13 19:13:57

flop25
Piwigo Team
2006-07-06
7037

Re: pwg.images.addSimple - escape character for commas in tags

fixed
[Subversion] r20741 if you want to apply the fix now, and test


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#5 2013-02-13 19:23:35

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: pwg.images.addSimple - escape character for commas in tags

just a question : why this field is not an array ? (like tag_id field in pwg.tags.getImages)

Offline

 

#6 2013-02-13 19:25:25

flop25
Piwigo Team
2006-07-06
7037

Re: pwg.images.addSimple - escape character for commas in tags

mistic100 wrote:

just a question : why this field is not an array ? (like tag_id field in pwg.tags.getImages)

Ho! Yeah... don't know... maybe historical reasons
If you have a better fix, I won't be offended ^^


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#7 2013-02-13 19:34:06

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: pwg.images.addSimple - escape character for commas in tags

we can't modify it for compatibility reasons, but why not adding an other field "tags2" or something, working like an array (and say that the first one is deprecated)

off-topic: I'm working on a small modification of reflexion.getMethodDetails allowing to add specific info for a field

Offline

 

#8 2013-02-13 19:42:04

flop25
Piwigo Team
2006-07-06
7037

Re: pwg.images.addSimple - escape character for commas in tags

mistic100 wrote:

we can't modify it for compatibility reasons

yep I thought of that

mistic100 wrote:

(and say that the first one is deprecated)

but didn't think as far
Good idea finally


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#9 2013-02-13 20:07:17

rvelices
Former Piwigo Team
2005-12-29
1960

Re: pwg.images.addSimple - escape character for commas in tags

I have a better fix
- make tags parameter as optional to accept array ( 'tags' => array('default' => null, 'flags' => WS_PARAM_ACCEPT_ARRAY),
- then

Code:

...
if (is_array(params[tags]))
tag_names = params[tags]
else
tag_names = explode(',', params[tags])

and that it is. fully backward compatible and properly working ...

Offline

 

#10 2013-02-13 20:18:22

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: pwg.images.addSimple - escape character for commas in tags

this API system is so well coded ! :-)

Offline

 

#11 2013-02-13 20:21:54

flop25
Piwigo Team
2006-07-06
7037

Re: pwg.images.addSimple - escape character for commas in tags

rvelices wrote:

I have a better fix
- make tags parameter as optional to accept array ( 'tags' => array('default' => null, 'flags' => WS_PARAM_ACCEPT_ARRAY),
- then

Code:

...
if (is_array(params[tags]))
tag_names = params[tags]
else
tag_names = explode(',', params[tags])

and that it is. fully backward compatible and properly working ...

and so spoke the voice of wisdom ^^

let me still add the escape of the comma for the string


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 
  •  » Engine
  •  » pwg.images.addSimple - escape character for commas in tags

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact