Jump to content
aComAdi

Image Field: Empty URL

Recommended Posts

Hi,

Have been working with ProcessWire for a few months now, successfully implementing several sites. I am compiling data management into modules for our clients. Several sites are using those modules now. The modules are using RockMigrations to install fileds, templates and pages.

Today, I installed a new site. And now I am tripping over an issue that I cannot explain. Content on pages is organized in 'rows'. The users can add row by using RepeaterMatrix...then completing the fields to add data to the row. One particular content row has image fields. When I upload the images to the fields, all works as expected. The images appear in the RepeaterMatrix and I do find the images in assets/files/xxxx. But the images are not displayed in the front-end (see attachment). As you can see in the attachment, the various text and textarea fields in the RepeaterMatrix item are displayed correctly.

I have done the following:

  • Compare field settings to the existing implementations: they are identical
  • Compare the RepeateMatrix settings and permissions to existing implementations: they are identical
  • Change field name. No change.
  • Delete field and created manually (including once with different name). No change.

If I dump the element with Tracey, I get the following output:

  • If Max Number = 1
    • null
  • If Max Number = 0
    • count => 0
      page => "/processwire/repeaters/for-field-136/for-page-1/1574873590-62-1/" (60)
      field => "wk_inhalt_start_links_bild" (26)
      url => "/serverpath/site/assets/files/1046/" (30)
      path => "/serverpath/serverpath/serverpath/serverpath/site/assets/files/1046/" (56)
      items => array ()

I would venture that there is an issue regarding images on the shared server...but another content element on the site works just fine with images.

Bit stumped right now. Especially considering that I made the same installation earlier today on a different server successfully. I would appreciate any ideas on where to investigate this issue.

screenshot-ford-gerbsch.ch-2019.11.27-18_45_15.png

Share this post


Link to post
Share on other sites

Follow-up:

I just ran a test with a different row type in that RepeaterMatrix and have the same issue: images can be uploaded, appear in the CMS, are up on the server...but are not displayed.

Share this post


Link to post
Share on other sites

What's your relevant code in your template file?

29 minutes ago, aComAdi said:

url => "/serverpath/site/assets/files/1046/"

That's not an image/file URL, i.e. not $imagefieldname->url

30 minutes ago, aComAdi said:

items => array ()

What's inside this array? I guess the images? Or is it empty?

Looking at your screenshot, why is there a visible <img src=... in the middle of nowhere? Did you inspect that?

Share this post


Link to post
Share on other sites

The object output I posted above, is from the dumping of the images field with Tracey Debugger:

bd($inhaltszeile->wk_inhalt_start_links_bild);

Regarding the weird output with the image tag: must have made a c&p mistake while trying to debug this issue. Has nothing to do with the problem at hand. Fixed the html issue though. (See screeshot attached.)

Here's a compacted version of the code which leads to the issue.

Code processing the RepeaterMatrix

foreach($page->wk_inhalt_zeile as $inhaltszeile) {
	switch ($inhaltszeile->repeater_matrix_type) {
		case '2':
        	bd($inhaltszeile->wk_inhalt_start_links_bild);
        	require  $_SERVER['DOCUMENT_ROOT'].$config->urls->templates.'_inhalt_occneu.php';
        	break;
	}
}

Code processing the RepeaterMatrix item in question, including the images:

<section class="about-us-section section-padding">
  <div class="container">
    <div class="section-header text-center">
      <h2><?php echo $inhaltszeile->wk_inhalt_titel; ?></h2>
      <?php echo $inhaltszeile->wk_inhalt_text1; ?>
    <div class="row">
      <div class="col-lg-6 col-sm-6">
        <div class="looking-car">
          <div class="looking-cat-image"> <img src="<?php echo $inhaltszeile->wk_inhalt_start_links_bild->url; ?>" alt="<?php echo $inhaltszeile->wk_inhalt_start_links_titel; ?>" /></div>
          <div class="looking-car-content">
            <h3><?php echo $inhaltszeile->wk_inhalt_start_links_titel; ?></h3>
            <?php
              echo $inhaltszeile->wk_inhalt_start_links_text;
            ?>
            <a href="<?php echo $inhaltszeile->wk_inhalt_start_links_link; ?>" class="btn"><?php echo __('Anzeigen'); ?><i class="fa fa-chevron-circle-right" aria-hidden="true"></i></a> </div>
        </div>
      </div>
      <div class="col-lg-6 col-sm-6">
        <div class="looking-car">
          <div class="looking-cat-image"> <img src="<?php echo $inhaltszeile->wk_inhalt_start_rechts_bild->url; ?>" alt="<?php echo $inhaltszeile->wk_inhalt_start_rechts_titel; ?>" /> </div>
          <div class="looking-car-content">
            <h3><?php echo $inhaltszeile->wk_inhalt_start_rechts_titel; ?></h3>
            <?php
              echo $inhaltszeile->wk_inhalt_start_rechts_text;
            ?>
            <a href="<?php echo $inhaltszeile->wk_inhalt_start_rechts_link; ?>" class="btn"><?php echo __('Anzeigen'); ?><i class="fa fa-chevron-circle-right" aria-hidden="true"></i></a> </div>
        </div>
      </div>
    </div>
  </div>
</section>

Notes:

  • Same code works as expected on other installations
  • Images are uploaded and visible in RepeaterMatrix Item in CMS
  • The RepeaterMatrix item is processed as expected in the front-end, with the exception of the image fields
  • Image fields in other RepeaterMatrix Types in the front-end are also not working correctly.

I have the suspicion, that this is an issue with the RepeaterMatrix, although all settings of the field are identical to other installations. Still appreciating ideas on where to dig with this. In the meantime, I will manually setup a new RepeaterMatrix.

 

screenshot-ford-gerbsch.ch-2019.11.28-08_28_03.png

Share this post


Link to post
Share on other sites

Update: manually created a new RepeaterMatrix and new image fields. Same results: the object returned does not contain the uploaded image.

Share this post


Link to post
Share on other sites

Hi @Gideon So,

Indeed I have. As a matter of fact, that is the intended setting, as only one image is allowed for the posting.

screenshot-ford-gerbsch.ch-2019_11.28-10_48_21.thumb.png.a511713e0aca234b75aa9a46f937c596.png

 

In this case when I dump the field, the response is Null

bd($inhaltszeile->wk_inhalt_start_links_bild);

If I switch Max Image settings to 0 (for debugging purposes), then I do recieve the above posted object back, but no images.

I honestly consider wiping the whole installation and starting new. Somethings is fishy here. I have also compared the settings of working vs non-working image fields. They seem identical:

{
    "wk_slider_bild": {
        "id": 179,
        "type": "FieldtypeImage",
        "flags": 0,
        "name": "wk_slider_bild",
        "label": "Slider/Banner-Bild",
        "columnWidth": 50,
        "description": "Bnnerbild",
        "entityencodedesc": 1,
        "extensions": "gif jpg peg png",
        "adminThumbs": 1,
        "maxFiles": 1,
        "fileSchema": 6,
        "outputFormat": 0,
        "outputString": "",
        "defaultValuePage": "",
        "textformatters": "",
        "entityEncode": "",
        "useTags": 0,
        "tagsList": "",
        "inputfieldClass": "InputfieldImage",
        "collapsed": 0,
        "showIf": "",
        "themeOffset": "",
        "themeBorder": "",
        "themeColor": "",
        "required": "",
        "requiredIf": "",
        "unzip": "",
        "overwrite": "",
        "descriptionRows": 1,
        "noLang": "",
        "gridMode": "grid",
        "focusMode": "on",
        "maxWidth": "",
        "maxHeight": "",
        "resizeServer": 0,
        "maxSize": "",
        "clientQuality": 90,
        "maxReject": "",
        "minWidth": "",
        "minHeight": "",
        "dimensionsByAspectRatio": ""
    }
}

{
    "wk_inhalt_start_links_bild": {
        "id": 211,
        "type": "FieldtypeImage",
        "flags": 0,
        "name": "wk_inhalt_start_links_bild",
        "label": "Start Intro Links: Bild",
        "extensions": "gif jpg jpeg png",
        "maxFiles": 1,
        "outputFormat": 0,
        "defaultValuePage": "",
        "useTags": 0,
        "inputfieldClass": "InputfieldImage",
        "descriptionRows": 1,
        "gridMode": "grid",
        "focusMode": "on",
        "resizeServer": 0,
        "clientQuality": 90,
        "maxReject": "",
        "dimensionsByAspectRatio": "",
        "fileSchema": 6,
        "collapsed": 0,
        "columnWidth": 50,
        "outputString": "",
        "textformatters": "",
        "entityEncode": "",
        "tagsList": "",
        "showIf": "",
        "themeOffset": "",
        "themeBorder": "",
        "themeColor": "",
        "required": "",
        "requiredIf": "",
        "unzip": "",
        "overwrite": "",
        "noLang": "",
        "maxWidth": "",
        "maxHeight": "",
        "maxSize": "",
        "minWidth": "",
        "minHeight": ""
    }
}

Somewhere along the way, something went wrong with the installation and there's an issue with either permissions on the RepeaterMatrix level or the Templates.

Share this post


Link to post
Share on other sites

I wiped the installation and started new. I am ending up at the same place. The RepeaterMatrix simply drops the fields of type Image.

That's the setup with a different item, but essentially having the same process as the original post above. Just replace wk_inhalt_start_links_bild with wk_inhalt_bilder :

screenshot-ford-gerbsch.ch-2019_11.28-14_45_13.thumb.png.b035c10401e5707bd2910037d3d2a8a6.png

Here I fill the fields successfully:

screenshot-ford-gerbsch.ch-2019_11.28-14_47_12.thumb.png.9c34f0f2993d49038d85c2ec444eff47.png

And when I dump the RepeaterMatrix item in the front-end, it's missing the image fields (wk_inhalt_bilder, wkinhaltbilder):

screenshot-ford-gerbsch.ch-2019_11.28-14_48_37.png.6ffa171eb5b27d30893b2ced59c00b7f.png

Starting to get desperate here.

 

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By humanafterall
      I'm using some Custom fields for images: 
      https://processwire.com/blog/posts/pw-3.0.142/#custom-fields-for-files-images

      When I save the page, and return the fields are blank. When I re-add the text to the fields and save again then the fields save as expected.

      I know this is stated as being quite experimental but it's super useful feature I'd love to get working correctly.
      I have fields that are CKEditor fields but have overidden this on the image specific template. I've also tried it with regular text fields and I get the same bug.
      (currently using Processwire 3.0.155)
      **UPDATE**
      I've found this issue is specific to editing on pages using the PageTable fieldtype. The fields are not saving when I save the page in the PageTable.
    • By Robin S
      Displays image tags overlaid on the thumbnail using customisable colours. This makes it easier to see which images have which tags without needing to open the edit pane for individual images or changing to the list view.
      Screenshot

      Usage
      Enable tags for one or more image fields. Install the Image Thumbnail Tags module. Optionally configure colours for any of your tags.
       
      https://github.com/Toutouwai/ImageThumbnailTags
      https://modules.processwire.com/modules/image-thumbnail-tags/
    • By EyeDentify
      Hello dear PW gurus.

      I have stumbled over a strange error that i all of sudden got when trying to upload an image to a images field on a page.
      There where images allready stored in the field that i wanted to keep, but during the upload the error apear and after that all images are gone from the field and i can´t upload any, i just get the error every time.
      I am running ProcessWire 3.0.153 dev.
      Update:
      After looking in the assets folder i find the folder for the page and the image files seems to be there including the ones i tried to upload when the error occured.
      But they don´t show up in the images field in the page editor.
       
      The error reported:
       
      SQLSTATE[01000]: Warning: 1265 Data truncated for column 'ratio' at row 1 And here is a screenshot of the event:

      The TracyDebugger Error reporting:

      I hope you fine folks could point me in a direction.
      But it seems our old pal set_time_limit() is back.

      Regards, EyeDentify
    • By Peter Knight
      If an image is added to a site via the rich text field, do we have a way to apply a custom wrapper or mini template to it?
      IE I want to apply some markup srcset to some user added images. I can only seem to achieve this when the image markup is in the template itself.
      https://github.com/rolandtoth/MarkupSrcSet/wiki
      I can probably achieve this with RepeaterMatrix and by creating a specific Images field (and images template) but outside of that ?
      Thanks
    • By Andi
      Continuing my journey into PW hooks, I'm trying to find a way to retrieve all images from a page that explicitly *do not* have a certain tag (or tags) attached to them.
      Found this post from 2015
      But I'm wondering if there's a more elegant way to go about this.
      Let's say I have a multi-image field called "images_header" and instead of
      $page->images_header->findTag('mytag'); I would like to do this:
      $page->images_header->excludeTag('mytag'); So I'd be able to do
      // find images that don't have the tag "mytag" $images = $page->images_header->excludeTag('mytag'); // check if there's any images if (count($images)>0) { // do something.. } Would this be possible by hooking into Pagefiles somehow?
      There's this bit in /wire/core/Pagefiles.php Line 626 that I'd basically just need to reverse (or at least in my mind 😄 )
      public function findTag($tag) { $items = $this->makeNew(); foreach($this as $pagefile) { if($pagefile->hasTag($tag)) $items->add($pagefile); } return $items; } Any ideas on how this could be done in a graceful manner?
      Thanks in advance!
×
×
  • Create New...