PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, March 14, 2022

[FIXED] codeigniter image path

 March 14, 2022     codeigniter, image, path     No comments   

Issue

I am a codeignite newbie and tried to add an image in my file under view folder.

I add <img src="../images/myImage.jpg"></img> to my service_view.php. All I can see is a broken link of a small icon.

however, if I change my path to

<img src="../../user_guide/images/myImage.jpg"></img>

I can see the image.

My file system is as follow:

application-
   view ->folder    (where service_view.php is located)
   images -> folder   (where myImage.jpg is located)

user_guide- 
   images ->folder  ((where myImage.jpg is located))

Can anyone help me about this? Thanks a lot!


Solution

I would suggest storing images in an images folder at the same level as the application folder, instead of trying to mix both PHP code and resources underneath application. Then just link to it like you did to the user guide:

<img src="../../images/myImage.jpg" />


Answered By - Justin Ethier
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing