Jump to content

Recommended Posts

Posted

Hello everyone!

I’m starting my PW journey and I’m enjoying it so far :-)

However, I’m having the exactly same problem as posted here https://processwire.com/talk/topic/10073-image-not-showing-up-in-tutorial/?hl=%2Bimage+%2B403

I’m running MAMP 3.2.1 on OSX 10.10.3

The issue is that the image doesn’t load on the page. It just gives me a broken link. If I click on the broken link I get:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /site/assets/files/1015/
on this server.</p>
</body></html>

Here is my PHP code:

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

And my field to showed that I used the same name for it.

3cVJS5V.png

More info:

  • I changed the assets/file permissions to 777. It didn’t work.
  • I changed MAMP user. It didn’t work.
  • There is no error.txt under logs folder.
  • There is no mod_security module.

I hope I can get some help here.

Regards,
Daniel

Posted

"/site/assets/files/1015/" I guess you have multiple image field which would be an array. How about 

<img src="<?php echo $page->promote->first->url; ?>" />
Posted

Hello @Soma

Yeah.. it worked. However, now I'm confuse.

I'm just following the tutorial But what if I don't know how to code?, and I didn't create any other image field.

Now I'm imagining how do I build a page that will display several images?

You talked about array (and I believe that the 'first' is the array index, right?). Could you give me more details?

Thank you a lot for your help.

Posted

Hi @zilli

Now I'm imagining how do I build a page that will display several images?

You can add as many images as you want to an image field in PW. This is assuming your images field hasn't been set to max 1 when setting up the image field.

If I have a PW page that requires several images, they're all dropped into my General Images field. Then, in CK editor, I choose which ones I want to manually output in my Body field.

If we're working with templates and you want to iterate through several images and echo them onto a page (for example, a gallery) , you can do that easily.

Can you give us a use-case? There is so much flexibility here, you can work in a number of ways with images.

  • Like 1
Posted

Thanks Peter.

I don't have a use-case now, I was just wondering how to do it. I just read the API docs and I'm starting to connect the dots. 

Thank you.

  • Like 1

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
×
×
  • Create New...