0

which is the secure way of displaying the image_path in src ?

`a. <img src = "<?php print check_url($image_path) ?>" />`
b. <img src = "<?php print check_plain($image_path) ?>" />
c. <img src = “<?php print htmlspecialchars($image_path) ?>” />
d. <img src= “<?php print strip_tags($image_path)?>” />
0

check_url basically checks for dangerous protocols in the url and escapes any special characters as HTML entities for output. Normally it's not needed unless outputting a raw external / absolute URL. For relative URLs, Drupal adds the base url automatically.

better to use first(a) option.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.