Welcome Guest, Not a member yet? Register   Sign In
Store img tags in database and retrieve it
#1

(This post was last modified: 05-14-2016, 12:40 PM by pb.sajjad.)

Hi to all developers...


When I developing an web application on localhost, every time that I want use <img> tag, I use base_url(); method to referring to image's path.

<img src="<?= base_url(); ?path/to/image/sample.jpg>" />

with this, when I migrate to real live server, everything is good. because using base_url() method.

Now I have some question:
1. I'm developing a CMS app that I write posts and store them in database table. I use CKeditor and in fact, store html tags in table. my question is how could I store and use images tags in table? As you know, I must prepare url (path) to reach images, and when I was developing app on localhost and write some posts, how could I handle this on live server? In fact, I must have a relative approach that there will be not any problems on different main urls. I could not store something like this 
<img src="<?= base_url(); ?path/to/image/sample.jpg>" /> into table. so what could I do?

2. I could use data-uri approach for storing images, with this I solve the problem, also, there will be less requests to server and in fact reduce http requests. but... Is this approach is good and efficient?

thanks to all experts that will be guide and answer to this questions...
Reply


Messages In This Thread
Store img tags in database and retrieve it - by pb.sajjad - 05-14-2016, 12:39 PM



Theme © iAndrew 2016 - Forum software by © MyBB