We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Volt image src from database

Hi again,

how can i set the image src from database:

{% for media in user.media %}

{{ image(media.image_1, "class":"img-responsive") }}

{% endfor %}

That is the generated html:

<img src="https://localhost:8000/projects/vokuro/clients/21/image_1/image_1.jpg" class="img-responsive">

The src is right, but the image can't be find, the permisions are set to 777.

KInd Regards

Stefan

What happened when you copy the src and put it in the url bar in the browser?



60.0k
edited Sep '15

Hi Bryan,

thank you for your fast reply, i get this:

Vokuro\Controllers\ClientsController handler class cannot be loaded
#0 [internal function]: Phalcon\Mvc\Dispatcher->_throwDispatchException('Vokuro\\Controll...', 2)
#1 [internal function]: Phalcon\Dispatcher->dispatch()
#2 C:\xampp\htdocs\projects\vokuro\public\index.php(33): Phalcon\Mvc\Application->handle()
#3 {main}

I must say, that I am using vokuro as base and clients is a directory, not a Controller.

Rgds

Stefan



60.0k
Accepted
answer
edited Sep '15

Hi @all,

i solved it. I moved the clients directory into the public directory, now it works.

This also works fine:

{% for media in user.media %}

{{ image(media.image_1, "class":"img-responsive") }}

{% endfor %}

Rgds

Stefan