This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hi! The logo column type (tinytext in Mysql) text in october cms is created in the database. I insert a media logo (.jpeg) via media finder (allowed in /storage/app/media/logo)
In ´columns.yaml´
logo: label: logo type: partial sortable: false path: ~/plugins/author/app/controllers/cars/_logo.htm
In ´fields.yaml´
logo: label: Logo mode: image span: auto type: mediafinder
In ´_logo.htm´ archive:
<img src="/storage/app/media/logos<?php echo $value; ?>">
It shows an icon default image not my logo image.
Could someone help me?
Thanks.
Last updated
emmanuel.makgabo14416 said:
<img src="<?= e($value) ?>" />
I put this on the _logo.htm but it doesn´t work.
Do I have to include any specific function of october?
I have something wrong but i don´t find the solution...
Last updated
mjauvin said:
In ´fields.yaml´ you wrote "mandato:"... should be "logo:"
Yes, it´s a mistake on the post. I have wrote "logo:"
I don´t understand why it doesn´t work
I upload the file from the media directory, it works. And the preview form shows the image correctly. The problem is in the list, it doesn´t work.
Last updated
Use this for your field partial (_logo.htm):
<?php if ($value): ?>
<img src="/storage/app/media<?= e($value) ?>" height=50 />
<?php endif ?>
Last updated
Actually, this would be better:
<?php if ($value): ?>
<img src="<?= Config::get('cms.storage.media.path') . e($value) ?>" height=50 />
<?php endif ?>
mjauvin said:
Actually, this would be better:
<?php if ($value): ?> <img src="<?= Config::get('cms.storage.media.path') . e($value) ?>" height=50 /> <?php endif ?>
Your answer looks very good but it doesn´t work. I don´t know why... because in the mysql database the route is correctly registered in the logo field as /logodirectory/logo1.jpg
Did you make changes to your .htaccess
file?
Please, show your actual folder tree under /storage
, also your cms.storage
config block and the html output of the backend list showing the logos
mjauvin said:
Did you make changes to your
.htaccess
file?Please, show your actual folder tree under
/storage
, also yourcms.storage
config block and the html output of the backend list showing the logos
Ok, the error was in the path. Fixed after adding http: // localhost before the path you indicated (in my case with the only difference of octobercms/... instead of cms/...). Another thing is that i don´t need to fix the height because the logo have a tiny size (40x30).
Thank you for your colaboration!
You should not need to add "http://localhost" ... that means either your cms.storage.media.path
does not start with "/" or something else is not right in your .htaccess file.
mjauvin said:
Use this for your field partial (_logo.htm):
<?php if ($value): ?> <img src="/storage/app/media<?= e($value) ?>" /> <?php endif ?>
Finally I use these partial:
<?php if ($value): ?> <img src="/octobercms/storage/app/media<?= e($value) ?>" /> <?php endif ?>
Thanks!
href="{{media.fichier|media }}" voici le code que j'ai écrit href="/storage/app/media/BENIN_SOTO.mp3" voilà le lien que cela m'envoie et je constate un "/"de trop en debut de la chaine
1-13 of 13