Forum

Thread tagged as: Problem, Field-Types
Drew McLellan

Drew McLellan 2638 points
Perch Support

That doesn't explain the change in behaviour to me. Can we see the template?

Here is the post template prior to noticing the odd behaviour...

<article class="tan col-3-4">
  <header class="article-title">
    <h1><perch:blog type="text" id="postTitle" label="Title" /></h1>
  </header>
  <aside>
    <p>Published: <perch:blog id="postDateTime" type="date" time="true" format="%d %B %Y" /></p>
  </aside>
  <perch:blog type="textarea" id="article-body" label="Article" />

</article>
</section>
<section class="artwork-bg">
   <img src="<perch:blog type="image" id="background-image" label="Background Image" />" />
</section>

<perch:blog type="textarea" id="excerpt" label="Excerpt" suppress="true" />
<perch:blog id="thumbnail" type="image" width="100" height="100" crop="true" suppress="true" />
<perch:blog id="postURL" type="hidden" suppress="true" />

Here is the same template after noticing the odd behaviour... mainly changing the perch:blog id="thumbnail" tag

<article class="tan col-3-4">
  <header class="">
    <h1><perch:blog type="text" id="postTitle" label="Title" /></h1>
  </header>
  <aside>
    <p>Published: <perch:blog id="postDateTime" type="date" time="true" format="%d %B %Y" /></p>
  </aside>
  <perch:blog type="textarea" id="article-body" label="Article" />

</article>
</section>
<section class="artwork-bg">
   <img src="<perch:blog type="image" id="background-image" label="Background Image" />" />
</section>

<perch:blog type="textarea" id="excerpt" label="Excerpt" suppress="true" />
<perch:blog id="thumbnail" type="image" label="Thumbnail" suppress="true" />
<perch:blog id="postURL" type="hidden" suppress="true" />

Then current template after thinking the id and label might be conflicting I changed the id to "post-work".

Drew McLellan

Drew McLellan 2638 points
Perch Support

Does it make a difference if the field doesn't have the ID thumbnail?

Also it looks like you have dashes in some of your IDs.

No changing the id thumbnail didn't work solve the issue either. It still displayed no preview image or replaced the select or upload image text for the field.

Are dashed IDs hard on the system or just bad practice?

Any chance you're using a bucket with a name that includes spaces? If so, I've found that that can create issues similar to what you've described.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Dashes are used by some features of the editing interface, so if you also use them in your IDs you could run into unexpected behaviour. This is why they are and always have been excluded from the permitted characters within an ID.

I finally got some time to get back to the site. What I attempted was removing all the dashes from the IDs in the template and templates that referenced the dashed IDs. Sadly, still no change in Perch even with the new IDs. Still no preview image or change of "select or upload an image" text link. Website still shows images.

Here's the new code... no major change except IDs as noted above.

<article class="tan col-3-4">
  <header class="">
    <h1><perch:blog type="text" id="postTitle" label="Title" /></h1>
  </header>
  <aside>
    <p>Published: <perch:blog id="postDateTime" type="date" time="true" format="%d %B %Y" /></p>
  </aside>
  <perch:blog type="textarea" id="articleBody" label="Article" />

</article>
</section>
<section class="artwork-bg">
   <img src="<perch:blog type="image" id="backgroundImage" label="Background Image" />" />
</section>

<perch:blog type="textarea" id="excerpt" label="Excerpt" suppress="true" />
<perch:blog id="postThumb" type="image" label="Thumbnail" suppress="true" />
<perch:blog id="postURL" type="hidden" suppress="true" />

Franz, I haven't set up any buckets for resources. All uploads are going to the resources folder.

I don't know if this will help but here is what the debug output after uploading an image. The only thing that strikes me is it saying no IDs to log. Is that normal?

Logging resources for perch_blog
DELETE FROM perch2_resource_log WHERE appID='perch_blog' AND itemFK='postID' AND itemRowID=2
INSERT IGNORE INTO perch2_resource_log(`appID`, `itemFK`, `itemRowID`, `resourceID`) VALUES('perch_blog','postID',2,16),('perch_blog','postID',2,17)
UPDATE perch2_blog_posts SET postStatus='Published', postTemplate='post.html', postTitle='Another post', postDateTime='2017-02-18 03:09:00', postDynamicFields='{\"article-body\":{\"_flang\":\"plain\",\"raw\":\"This is some text.\",\"processed\":\"This is some text.\"},\"background-image\":{\"assetID\":\"4\",\"title\":\"SW Gameplay\",\"_default\":\"\\/perch\\/resources\\/sw-gameplay.jpg\",\"bucket\":\"default\",\"path\":\"sw-gameplay.jpg\",\"size\":150244,\"w\":800,\"h\":533,\"mime\":\"image\\/jpeg\",\"sizes\":{\"thumb\":{\"w\":\"150\",\"h\":\"99\",\"target_w\":150,\"target_h\":150,\"density\":2,\"path\":\"sw-gameplay-thumb@2x.jpg\",\"size\":26682,\"mime\":\"\",\"assetID\":\"5\"}}},\"excerpt\":{\"_flang\":\"plain\",\"raw\":\"Here is a summary.\",\"processed\":\"Here is a summary.\"},\"thumbnail\":{\"assetID\":\"1\",\"title\":\"SW Featured\",\"_default\":\"\\/perch\\/resources\\/sw-featured.jpg\",\"bucket\":\"default\",\"path\":\"sw-featured.jpg\",\"size\":475732,\"w\":1600,\"h\":1067,\"mime\":\"image\\/jpeg\",\"sizes\":{\"thumb\":{\"w\":\"150\",\"h\":\"100\",\"target_w\":150,\"target_h\":150,\"density\":2,\"path\":\"sw-featured-thumb@2x.jpg\",\"size\":25921,\"mime\":\"\",\"assetID\":\"2\"}}},\"articleBody\":{\"_flang\":\"plain\",\"raw\":\"\",\"processed\":\"\"},\"backgroundImage\":{\"assetID\":\"16\",\"title\":\"Splendor gameplay\",\"_default\":\"\\/perch\\/resources\\/splendor-gameplay.jpg\",\"bucket\":\"default\",\"path\":\"splendor-gameplay.jpg\",\"size\":128460,\"w\":800,\"h\":533,\"mime\":\"image\\/jpeg\"},\"postThumb\":{\"assetID\":\"17\",\"title\":\"Splendor components\",\"_default\":\"\\/perch\\/resources\\/splendor-components.jpg\",\"bucket\":\"default\",\"path\":\"splendor-components.jpg\",\"size\":122810,\"w\":800,\"h\":533,\"mime\":\"image\\/jpeg\"}}' WHERE postID='2'
No ids to log.
UPDATE perch2_blog_posts SET postStatus='Published', postTemplate='post.html', postTitle='Another post', postDateTime='2017-02-18 03:09:00', postDynamicFields='{\"article-body\":{\"_flang\":\"plain\",\"raw\":\"This is some text.\",\"processed\":\"This is some text.\"},\"background-image\":{\"assetID\":\"4\",\"title\":\"SW Gameplay\",\"_default\":\"\\/perch\\/resources\\/sw-gameplay.jpg\",\"bucket\":\"default\",\"path\":\"sw-gameplay.jpg\",\"size\":150244,\"w\":800,\"h\":533,\"mime\":\"image\\/jpeg\",\"sizes\":{\"thumb\":{\"w\":\"150\",\"h\":\"99\",\"target_w\":150,\"target_h\":150,\"density\":2,\"path\":\"sw-gameplay-thumb@2x.jpg\",\"size\":26682,\"mime\":\"\",\"assetID\":\"5\"}}},\"excerpt\":{\"_flang\":\"plain\",\"raw\":\"Here is a summary.\",\"processed\":\"Here is a summary.\"},\"thumbnail\":{\"assetID\":\"1\",\"title\":\"SW Featured\",\"_default\":\"\\/perch\\/resources\\/sw-featured.jpg\",\"bucket\":\"default\",\"path\":\"sw-featured.jpg\",\"size\":475732,\"w\":1600,\"h\":1067,\"mime\":\"image\\/jpeg\",\"sizes\":{\"thumb\":{\"w\":\"150\",\"h\":\"100\",\"target_w\":150,\"target_h\":150,\"density\":2,\"path\":\"sw-featured-thumb@2x.jpg\",\"size\":25921,\"mime\":\"\",\"assetID\":\"2\"}}},\"articleBody\":{\"_flang\":\"plain\",\"raw\":\"\",\"processed\":\"\"},\"backgroundImage\":{\"assetID\":\"16\",\"title\":\"Splendor gameplay\",\"_default\":\"\\/perch\\/resources\\/splendor-gameplay.jpg\",\"bucket\":\"default\",\"path\":\"splendor-gameplay.jpg\",\"size\":128460,\"w\":800,\"h\":533,\"mime\":\"image\\/jpeg\"},\"postThumb\":{\"assetID\":\"17\",\"title\":\"Splendor components\",\"_default\":\"\\/perch\\/resources\\/splendor-components.jpg\",\"bucket\":\"default\",\"path\":\"splendor-components.jpg\",\"size\":122810,\"w\":800,\"h\":533,\"mime\":\"image\\/jpeg\"}}', postSlug='2017-02-18-another-post' WHERE postID='2'
No ids to log.
DELETE FROM perch2_blog_index WHERE itemKey='postID' AND itemID='2'
INSERT INTO perch2_blog_index (itemKey, itemID, indexKey, indexValue) VALUES ('postID',2,'article-body','This is some text.'),('postID',2,'article-body__flang','plain'),('postID',2,'article-body_raw','This is some text.'),('postID',2,'article-body_processed','This is some text.'),('postID',2,'background-image','/perch/resources/sw-gameplay.jpg'),('postID',2,'background-image_assetID','4'),('postID',2,'background-image_title','SW Gameplay'),('postID',2,'background-image__default','/perch/resources/sw-gameplay.jpg'),('postID',2,'background-image_bucket','default'),('postID',2,'background-image_path','sw-gameplay.jpg'),('postID',2,'background-image_size','150244'),('postID',2,'background-image_w','800'),('postID',2,'background-image_h','533'),('postID',2,'background-image_mime','image/jpeg'),('postID',2,'excerpt','Here is a summary.'),('postID',2,'thumbnail','/perch/resources/sw-featured.jpg'),('postID',2,'thumbnail_assetID','1'),('postID',2,'thumbnail_title','SW Featured'),('postID',2,'thumbnail__default','/perch/resources/sw-featured.jpg'),('postID',2,'thumbnail_bucket','default'),('postID',2,'thumbnail_path','sw-featured.jpg'),('postID',2,'thumbnail_size','475732'),('postID',2,'thumbnail_w','1600'),('postID',2,'thumbnail_h','1067'),('postID',2,'thumbnail_mime','image/jpeg'),('postID',2,'articleBody',''),('postID',2,'backgroundImage','/perch/resources/splendor-gameplay.jpg'),('postID',2,'postThumb','/perch/resources/splendor-components.jpg'),('postID',2,'postID','2'),('postID',2,'blogID','1'),('postID',2,'postTitle','Another post'),('postID',2,'postSlug','2017-02-18-another-post'),('postID',2,'postDateTime','2017-02-18 03:09:00'),('postID',2,'postDescRaw',''),('postID',2,'postDescHTML',''),('postID',2,'postTags',''),('postID',2,'postStatus','Published'),('postID',2,'authorID','0'),('postID',2,'sectionID','1'),('postID',2,'postCommentCount','0'),('postID',2,'postImportID',''),('postID',2,'postLegacyURL',''),('postID',2,'postAllowComments','1'),('postID',2,'postTemplate','post.html'),('postID',2,'postMetaTemplate','post_meta.html'),('postID',2,'itemID',''),('postID',2,'itemRowID',''),('postID',2,'postURL','/blog/post.php?s=2017-02-18-another-post'),('postID',2,'_id',2)