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 longtom
      I'm creating this site where a 'motherpage' renders all subpages.  I switched on frontend editing to make editing as easy as possible to end-users. 
      I'm stuck on adding images to the subpages.  The frontend editor suggests to add images to the motherpage (that has no images field on it, nor should it), so it asks for another page to add the images to/from. 
      Is there a way to make the frontend-editor context aware so that it looks for images in the correct subpage? 
      I already tried the 'type C' approach and added <edit field="body" page="id">, but that doesn't seem to do the trick. 
    • By Rossie
      Hi Everyone,
      I wish to display a gallery of images from multiple pages on the site.  These images have custom fields created through page reference called 'furniture_list_type'.  Each image now has a radio button which has been selected.
      In  the example code below all images appear from the "gallery20", however the selector  "gallery20.furniture_list_type=3390" does not have any effect.  "3390" is the id of the page reference "chair" selected through the page reference.  I wish only images selected as chair to show.
      Hope someone can help with this.
       
      Thanks,
       
      Calum
       
      $imagePages = $pages->find("template=makers-child, gallery20.furniture_list_type=3390") ;                     foreach($imagePages as $p) {     echo "<ul>";     foreach($p->gallery20 as $image) {         echo "<li><img src='{$image->url}'>{$image->furniture_list_type}</li>";     }     echo "</ul>";      }
    • By daniel_puehringer
      Hey,

      so we all know about SEO and the importance of performance. Basically we do it, because if no one finds the website we just built, it´s frustrating. We all try to write clean markup, css and js code and most might have a webpack/gulp/whatever pipeline to minimize css&js.
      But when thinking about it, optimizing your pipeline might save you a few (hundreds) of kb, compared to loading an image with 1 mb that´s literally nothing and frankly just ridiculous.

      Don´t get me wrong, frontend pipelines are great and should be used, but let´s shift your "I will optimize the shit out of that 3 css lines" focus to something different: try to serve images as fast as possible, this is where the performance boost really happens.

      I´m no pro on processwire so far, but I built a very easy to use picture element, which some of you could find interesting:

      1. the picture comes with 3 different sizes: one for mobile (keep in mind the double dpi, therefore width of 828px), one for tablet and one for desktop
      2. the picture generates a webp version and the original file extension as a fallback
      3. the filesize of each element is rendered within the "data" attribute
      4. lazy loading(sooo important!!!) is done via the native 'loading="lazy"' attribute.


      Please try it out and see the difference 🙂

      I posted this so others can easily optimize their images, but I would also like to hear your suggestions in making it better. Maybe you could decrease the rendering time or maybe you have some easy improvements.

      Please let me know.

      Greetings from Austria!


       
      <picture> <source data="<?php echo($oElement->repeater_image->width(828)->webp->filesize);?>" media="(max-width: 414px)" srcset="<?php echo($oElement->repeater_image->width(828)->webp->url) ?> 2x" type="image/webp"> <source data="<?php echo($oElement->repeater_image->width(828)->filesize) ?>" media="(max-width: 414px)" srcset="<?php echo($oElement->repeater_image->width(828)->url) ?> 2x" type="image/<?php echo($oElement->repeater_image->ext)?>"> <source data="<?php echo($oElement->repeater_image->width(767)->webp->filesize) ?>" media="(min-width: 415) and (max-width: 767px)" srcset="<?php echo($oElement->repeater_image->width(767)->webp->url) ?> 2x" type="image/webp"> <source data="<?php echo($oElement->repeater_image->width(767)->filesize) ?>" media="(min-width: 415) and (max-width: 767px)" srcset="<?php echo($oElement->repeater_image->width(767)->url) ?> 2x" type="image/<?php echo($oElement->repeater_image->ext)?>"> <source data="<?php echo($oElement->repeater_image->webp->filesize) ?>" media="(min-width: 768px)" srcset="<?php echo($oElement->repeater_image->webp->url) ?>" type="image/webp"> <source data="<?php echo($oElement->repeater_image->filesize) ?>" media="(min-width: 768px)" srcset="<?php echo($oElement->repeater_image->url) ?>" type="image/<?php echo($oElement->repeater_image->ext)?>"> <img data="<?php echo($oElement->repeater_image->filesize) ?>" class="img-fluid" loading="lazy" src="<?php echo($oElement->repeater_image->url) ?>" alt="<?php echo($oElement->repeater_image->description) ?>" type="image/<?php echo($oElement->repeater_image->ext)?>"> </picture>
    • By picarica
      so hello i am trying to combine my whole ass gallery with custom created watermark, i wanted to combine my images with simple text little opaque but that seemed harder and i couldnt make it work, well i cant make this work either, how are you handling watermarks? i would prefer if it would be plain PHP no imagemagick or some custom plugins scripts, but if neccesary i wont deny.
      so here's my code
      $pa = $pages->find("template=basic-page|art_gallery, images.tags!=''"); /* $pa = $pages->find("has_parent!=2,id!=2|7,status<".Page::statusTrash.",include=all"); */ echo "<div BRUUH class='row gtr-50 gtr-uniform js-filter' id='gal' >"; foreach ($pa as $p) { foreach($p->images as $image) { $obrazok = $image->url; $image = imagecreatefromjpeg($obrazok); $frame = imagecreatefromjpeg($pages->get('/settings/')->watermark->url); /* echo $image; echo $frame; */ # If you know your originals are of type PNG. imagecopymerge($image, $frame, 0, 0, 0, 0, 50, 50, 100); # Output straight to the browser. $img = imagepng($image); $options = array('quality' => 70, 'upscaling' => true, 'cropping' => 'center', 'sharpening'=>'medium'); $thumb = $img->size(400, 300, $options); $large = $img->size(1200, 0, $options); echo "<div class='$image->tags' class='col-4'>"; echo "<span style='overflow:hidden;'class='image fit'>"; echo "<a href='$large->url'>"; echo "<img class='uk-transform-origin-top-right' uk-scrollspy='cls: uk-animation-fade; repeat: false' src='$thumb->url' alt='$image->tags'>"; echo "</a>"; echo "</span>"; echo "</div>"; } };  
    • By David Karich
      ProcessWire InputfieldRepeaterMatrixDuplicate
      Thanks to the great ProModule "RepeaterMatrix" I have the possibility to create complex repeater items. With it I have created a quite powerful page builder. Many different content modules, with many more possible design options. The RepeaterMatrix module supports the cloning of items, but only within the same page. Now I often have the case that very design-intensive pages and items are created. If you want to use a content module on a different page (e.g. in the same design), you have to rebuild each item manually every time.
      This module extends the commercial ProModule "RepeaterMatrix" by the function to duplicate repeater items from one page to another page. The condition is that the target field is the same matrix field from which the item is duplicated. This module is currently understood as proof of concept. There are a few limitations that need to be considered. The intention of the module is that this functionality is integrated into the core of RepeaterMatrix and does not require an extra module.
      Check out the screencast
      What the module can do
      Duplicate multible repeater items from one page to another No matter how complex the item is Full support for file and image fields Multilingual support Support of Min and Max settings Live synchronization of clipboard between multiple browser tabs. Copy an item and simply switch the browser tab to the target page and you will immediately see the past button Support of multiple RepeaterMatrix fields on one page Configurable which roles and fields are excluded Configurable dialogs for copy and paste Duplicated items are automatically pasted to the end of the target field and set to hidden status so that changes are not directly published Automatic clipboard update when other items are picked Automatically removes old clipboard data if it is not pasted within 6 hours Delete clipboard itself by clicking the selected item again Benefit: unbelievably fast workflow and content replication What the module can't do
      Before an item can be duplicated in its current version, the source page must be saved. This means that if you make changes to an item and copy this, the old saved state will be duplicated Dynamic loading is currently not possible. Means no AJAX. When pasting, the target page is saved completely No support for nested repeater items. Currently only first level items can be duplicated. Means a repeater field in a repeater field cannot be duplicated. Workaround: simply duplicate the parent item Dynamic reloading and adding of repeater items cannot be registered. Several interfaces and events from the core are missing. The initialization occurs only once after the page load event Attention, please note!
      Nested repeaters cannot be supported technically. Therefore a check is made to prevent this. However, a nested repeater can only be detected if the field name ends for example with "_repeater1234". For example, if your MatrixRepeater field is named like this: "content_repeater" or "content_repeater123", this field is identified as nested and the module does not load. In version 2.0.1 the identification has been changed so that a field ending with the name repeater is only detected as nested if at least a two-digit number sequence follows. But to avoid this problem completely, make sure that your repeater matrix field does NOT end with the name "repeater".
      Changelog
       
      2.0.1
      Bug fix: Thanks to @ngrmm I could discover a bug which causes that the module cannot be loaded if the MatrixRepeater field ends with the name "repeater". The code was adjusted and information about the problem was provided 2.0.0
      Feature: Copy multiple items at once! The fundament for copying multiple items was created by @Autofahrn - THX! Feature: Optionally you can disable the copy and/or paste dialog Bug fix: A fix suggestion when additional and normal repeater fields are present was contributed by @joshua - THX! 1.0.4
      Bug fix: Various bug fixes and improvements in live synchronization Bug fix: Items are no longer inserted when the normal save button is clicked. Only when the past button is explicitly clicked Feature: Support of multiple repeater fields in one page Feature: Support of repeater Min/Max settings Feature: Configurable roles and fields Enhancement: Improved clipboard management Enhancement: Documentation improvement Enhancement: Corrected few typos #1 1.0.3
      Feature: Live synchronization Enhancement: Load the module only in the backend Enhancement: Documentation improvement 1.0.2
      Bug fix: Various bug fixes and improvements in JS functions Enhancement: Documentation improvement Enhancement: Corrected few typos 1.0.1
      Bug fix: Various bug fixes and improvements in the duplication process 1.0.0
      Initial release Support this module
      If this module is useful for you, I am very thankful for your small donation: Donate 5,- Euro (via PayPal – or an amount of your choice. Thank you!)
      Download this module (Version 2.0.1)
      > Github: https://github.com/FlipZoomMedia/InputfieldRepeaterMatrixDuplicate
      > PW module directory: https://modules.processwire.com/modules/inputfield-repeater-matrix-duplicate/
      > Old stable version (1.0.4): https://github.com/FlipZoomMedia/InputfieldRepeaterMatrixDuplicate/releases/tag/1.0.4
×
×
  • Create New...