img_path not working in simple module view

edited October 2011 in Modules
I'm using the news module from the pages tutorial and images added through markitup
are not showing up in the view.

However, they do appear when I preview the post in the admin area.

Blog post images are working as they should.

What might I be missing?


  • edited 7:22AM
    More info...

    I just realized the templating syntax is not being converted to straight html in the view...

    is showing in the source code.
  • edited 7:22AM
    Forgot to add code tags above...
    <img src="{img_path('authors/adidas_thumb04.jpg')}" alt="" />
  • edited 7:22AM
    Try adding the following to your model.
    public $parsed_fields = array('content', 'content_formatted');
    I've updated the tutorial to help with this:
  • edited 7:22AM
    Thanks!! That worked.
  • edited 7:22AM
    I'm running into a similar issue and it's not resolving after having added the above $parsed_fields line. My column is "content" though it doesn't appear to be sticking. The tutorial only mentions $parsed_files twice and so I'm at a loss. Thoughts?
  • edited 7:22AM
    Any chance of you showing us the model (you can wrap in code tags)?
  • edited 7:22AM
    Below you can see my model , but it has not shown the image in the contents and still I just see in my html inspect element.
    Could you please help me to solve it?

    <?php if (!defined('BASEPATH')) exit('No direct script access allowed');


    class site_hozes_model extends Base_module_model {

    public $belongs_to = array('projects' => 'projects_model');
    public $parsed_fields = array('content', 'content_formatted');

    public $filters_join = 'or';

    function __construct()
    function form_fields($values = array(), $related = array())
    $fields = parent::form_fields($values, $related);

    // ******************* ADD CUSTOM FORM STUFF HERE *******************
    $fields['content']['img_folder'] = 'docs/images';
    $fields['image']['folder'] = 'docs/images/';
    $fields['thumb_image']['folder'] = 'docs/images';

    return $fields;


    class site_hoze_model extends Base_module_record {

  • edited 7:22AM
    What image path is it using instead?
  • edited 7:22AM
    it does not understand the img path at all.
    and if I even write <?php echo "hi" ?> it shows exactly that and it does not understand that it is something related to php and it can not interpreted as php code.
  • edited 7:22AM
    What is the src value of the image if you view source?
  • edited January 2016
    Thanks for your supports.
    < img src="{ img_path('ab.png')}" >
    this is what I have in my view.
  • edited 7:22AM
  • edited 7:22AM
    Does it work if you remove the space between the { and "img_path"
  • edited 7:22AM
    No i just put the space myself to show it here. Actually there is no space between them
  • edited 7:22AM
    I just realized that above you said that's what you had in your view? By default, FUEL will not parse template tags in your view files. It will parse content from the database for the content field since you specified the $parsed_fields.
  • edited 7:22AM
    So why I can not see my image in my view file?
  • edited 7:22AM
    In fact it does not parse content from the database and when I write something in the texteditor and when I upload image in the texteditor in my models , I can see the texts but not he image and instead showing the image I do not have nothing in my view.
    When I use inspect element to trace my html, I just can see < img src="{ img_path('ab.png')}" >.
    Is there a way that I can fix it?
    I would highly appreciate your consideration.
  • edited 7:22AM
    I imagine that the output is being presented somehow in a view file. Does it work if you wrap it with the following in your view file:
    <?php echo $CI->fuel->parser->parse_string($site_hoze->content);?>
  • edited March 2017
    Hello all,

    I have a problem with parsing, I want to disable it. When I insert an image in content I get this:
    < img src="{img_path('small_image.jpg')}" alt="" />

    And I need this:
    < img src="" alt="" />

    The problem is that editor modify the URL. I must disable that but do not know how and where. Can someone help?
    I am using ckeditor, if that makes difference.
  • edited 7:22AM
    Can you replace the parameter value with the full http path? The img_path function should utilize that path and ignore it the generated relative path (it detects the http://).
  • edited March 2017
    I am adding images using fuel system, by selecting the image uploaded earlier.
    I nee full path of image to be written in database.
    What I need is < img scr="http://...full-image-path/image.jpg" />
    I have find out that when I add < img > manually into text (copy html and paste it), the editor script change src path to {img_path('small_image.jpg')}
    I have to avoid that.

    I have modified fuelimage plugin ckeditor/plugins/fuelimage/plugin.js to add my full path and image name:
    editor.insertHtml("< img src='http://full-domain-image-path/"+varPictureName+"'"/>);

    But other Fuel script (or editor script) change the full path. I have to resolve this. I do not know why is this happening. It does not happen for any other type of tag.

    When I just change it to add editor.insertHtml("< img src=''/>;");

    It will give me this as result:
    < img src="{img_path('')}" />

    How can I exclude this {img_path(' ')} from src?

  • edited 7:22AM
    The code for that is in the core JS file at fuel/modules/fuel/assets/js/fuel/custom_fields.js around line 241.

    I've just pushed this fix to the develop branch:
  • edited 7:22AM
    Wow! That worked. I have figure out where to remove brackets "img_path('" + img + "')" but could not figure out for full url. Now works! Thanks man.
Sign In or Register to comment.