Author Topic: " in image description sucks  (Read 5522 times)

0 Members and 1 Guest are viewing this topic.

Offline I_Want_Mods_2

  • Newbie
  • *
  • Posts: 21
    • View Profile
" in image description sucks
« 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 ' ?
I use 4images 1.7.6

Offline I_Want_Mods_2

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: " in image description sucks
« Reply #1 on: March 19, 2009, 07:19:48 PM »
Can anyone help me?
I use 4images 1.7.6

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: " in image description sucks
« Reply #2 on: March 20, 2009, 01:42:30 AM »
what kind of problems?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline I_Want_Mods_2

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: " in image description sucks
« Reply #3 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.
I use 4images 1.7.6

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: " in image description sucks
« Reply #4 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}
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline I_Want_Mods_2

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: " in image description sucks
« Reply #5 on: March 20, 2009, 04:41:09 PM »
It works. 10x. You are genius!
I use 4images 1.7.6