4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: I_Want_Mods_2 on March 10, 2009, 04:35:14 PM

Title: " in image description sucks
Post by: I_Want_Mods_2 on March 10, 2009, 04:35:14 PM
I don't want uploaders to put " in the image description.
" makes problems, but ' is awesome!  :D
How to replace " with ' ?
Title: Re: " in image description sucks
Post by: I_Want_Mods_2 on March 19, 2009, 07:19:48 PM
Can anyone help me?
Title: Re: " in image description sucks
Post by: V@no on March 20, 2009, 01:42:30 AM
what kind of problems?
Title: Re: " in image description sucks
Post by: I_Want_Mods_2 on March 20, 2009, 10:07:53 AM
In my site the description of the image, given by the uploader is included in <meta name="description" content="bla-bla description.">
If someone upload a image and write a description "Beautiful animals" that means that the description will be something like this - <meta name="description" content="Beautiful animals">

In /templates/default/details.html I have something like this:
Code: [Select]
<meta name="description" content="{image_description}">
And if the uploader put " in the description then " will cause problem in <meta name="description" content="Beautiful animals"> Thats why I want to replace " with ' because ' doesn't make problem.
Title: Re: " in image description sucks
Post by: V@no on March 20, 2009, 03:43:30 PM
I think you'd better off fixing the description by doing this:
in includes/functions.php find:
Code: [Select]
    "image_description" => $description,Insert below:
Code: [Select]
    "image_description_fixed" => str_replace('"', '&nbsp;', $description),

In your template use {image_description_fixed}
Title: Re: " in image description sucks
Post by: I_Want_Mods_2 on March 20, 2009, 04:41:09 PM
It works. 10x. You are genius!