This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

pablete
pablete

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
emmanuel.makgabo14416
<img src="<?= e($value) ?>" />
pablete
pablete

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
mjauvin

In ´fields.yaml´ you wrote "mandato:"... should be "logo:"

pablete
pablete

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

mjauvin
mjauvin

Use this for your field partial (_logo.htm):

<?php if ($value): ?>
   <img src="/storage/app/media<?= e($value) ?>" height=50 />
<?php endif ?>

Last updated

mjauvin
mjauvin

Actually, this would be better:

<?php if ($value): ?>
   <img src="<?= Config::get('cms.storage.media.path') . e($value) ?>" height=50 />
<?php endif ?>
pablete
pablete

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

mjauvin
mjauvin

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

pablete
pablete

mjauvin said:

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

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!

mjauvin
mjauvin

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.

pablete
pablete

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!

yveszanou61457
yveszanou61457

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

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.