Jump to content

Single Image


ODDCODE
 Share

Recommended Posts

Hi, I am new to using Processwire. How do you insert a single image into a page. I tried using  this <img src="<?php $config->path->templates?>images/b1.jpeg"> 

or   <img src="assets/images/b1.jpeg"> nothing display on the page. I am not understanding something. Can someone help please. Thank you

Link to comment
Share on other sites

It should be

<img src="<?php echo $config->urls->templates; ?>images/b1.jpeg">

Also check if the image is really jpeg and not jpg.

But normally you should create an Image field, add to your template, and echo from there.

<img src="<?php echo $page->image_field; ?>"/>

You may need to append ->first() and resize methods, search for "processwire images" on google.

  • Like 2
Link to comment
Share on other sites

I think you want

<img src="<?php echo $config->urls->templates ?>images/b1.jpeg">

or with short syntax

<img src="<?= $config->urls->templates ?>images/b1.jpeg">

And to be honest, I usually hard code the paths to my template images.

<img src="/site/templates/images/b1.jpeg">

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...