Forums

adding img into kses (10 posts)

  1. Anonymous
    Unregistered
    Posted 5 years ago #

    ok, i'm pretty bad at php, could someone tell me how to add support for img tags into the $allowedtags attribute in kses.php?

  2. carthik
    Member
    Posted 5 years ago #

    edit kses.php as shown in the excerpt from my edited kses.php

    $allowedtags = array(
    'a' => array(
    'href' => array(),
    'title' => array(),
    'rel' => array()),
    'img' => array(
    'src' => array(),
    'alt' => array(),
    'width' => array(),
    'height' => array()),
    'abbr' => array('title' => array()),

    in short, I inserted

    'img' => array(
    'src' => array(),
    'alt' => array(),
    'width' => array(),
    'height' => array()),

    between the 'a' and the 'abbr' arrays.
    Hope this helped.

  3. Chad_Coleman
    Member
    Posted 5 years ago #

    2fargon,
    Is there a possibility you could throw up a version of that exact same code with restrictions set in the width and height of the image?

  4. ZBRob
    Member
    Posted 5 years ago #

    Very just question, Chad. /me is curious too.

  5. Chad_Coleman
    Member
    Posted 5 years ago #

    I'm speakin out of ignorance, but I would guess that it would look something like:
    'img' => array(
    'src' => array(),
    'alt' => array(),
    'width' => array(300),
    'height' => array(400)),
    Maybe 2fargon will check this post sooner better than later, and verify this.

  6. ZBRob
    Member
    Posted 5 years ago #

    I hope anyone does, to be honest.

  7. ZBRob
    Member
    Posted 5 years ago #

    Does this need PHP fu or something? I saw that textpattern allows you to set the maximum width, but I don't know if that was a normal install.

  8. dss
    Member
    Posted 4 years ago #

    Has anyone gotten this to work?

    I'd sure love to add images to (at least certain) comments.

  9. Sproke
    Member
    Posted 3 years ago #

    I've tried doing this, but it doesn't seem to work. I keep getting an error.

    Has anyone got this to work, and can put up a txt part of their kses.php please?

  10. Kafkaesqui
    Moderator
    Posted 3 years ago #

    Sproke:

    http://wordpress.org/support/topic/69047#post-364059

    Where I suggest placing the 'font' tag array, instead you want to insert this line:

    'img' => array('src' => array(), 'alt' => array(), 'width' => array(), 'height' => array()),

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.