Jump to content

totoff

Members
  • Posts

    495
  • Joined

  • Last visited

  • Days Won

    4

Posts posted by totoff

  1. Dear all,

    tomorrow I'll have to introduce some editors on how to upload and edit images in image fields in Processwire. The site in question is quite image rich and I've spent some time to serve the appropriate images via scrcset already cropped for different screen sizes.

    However, the backend offers a lot of possibilities to manipulate images and most of them I'm not familiar with because as a developer I've never spent much thinking on what all the features might be good for … Yet I'm concerned that my editors work on images in the backend may interfere with my optimization strategies in the templates.

    Is there a general rule of thumb what content editors should do or not do with images in order not to break srcset strategies etc.? Maybe there is already a source of information you could point me to?

    Your recommendations are much appreciated!

  2. @BillH Man, you saved my live. I had a nightmare last night, seeing myself migrating dozens of entries manually but your code came to the rescue. It works! Here is my code:

    page()->of(false);
    foreach (page()->images as $image) {
        $image->artist_name = $page->title;
        if($image->description):
        $image->title = $image->description;
        $image->image_caption = $image->description;
        endif;
        // first save inside loop saves the field value
        $page->save('images');
    }
    // saves the page
    $page->save();

    Yesterday I had the output formatting statement inside the loop and I assume this was the mistake. Thanks for helping me!

    • Like 3
  3. Hi elabx,

    thanks, really appreciate your help. Unfortunately that doesn't work either. I've tried all kinds of variations including setting the image title as this is a mandatory field. This is where I currently am:

    foreach (page()->images as $image) {
        page()->of(false);
        $image->title = $image->description;
    	bd($image->title, 'title');
        $page->save('images');
    }

    But it doesn't work. The value for $image->title is assigned (as I can see with Tracy) but doesn't get stored to the database. ?

  4. This is driving me nuts! I managed to set the value for a single image description field and saving it using page->save(); but no luck with values I set for the custom fields inside the foreach loop. They are not saved to the database. Im sure this has a super obvious reason but I'm lost finding it.

    Any help is much appreciated.

  5. Dear all,

    I'm upgrading an older side with the new custom fields for images feature as of 3.0.142. My image field is set to "Automatic" and holds a bunch of images together with their respective description on each page. New custom fields include "caption" among others and to make my live easier I I'm trying to populate "caption" with the value from the (default) description field. But unfortunately I can't seem to find out how to save the newly set values. This is my code:

    <?php foreach (page()->images as $image) {
    	$image->set('caption', $image->description);
    	bd($image->caption);
        echo files()->render("markup/views/view-card-image-fancybox.php", array('image'=>$image));
    } ?>
    <?php 
    $page->save();
    bd($page->save());
    ?>

    This sets the value as intended (see screenshot) but doesn't save it permanently to the database. What am I doing wrong?

    Thanks!

     

    Bildschirmfoto 2021-02-22 um 15.33.38.png

  6. 5 hours ago, Juergen said:

    Sorry, @totoff,

    my fault. It mean the Fullcalendar. I use it with Uikit markup (badges,..) so I always call it "UiKit calendar". This was a mistake. Anyway, you can use it with recurme. Here you can find the Bootstrap calendar. Both are available on Jsdelivr CDN. So no need to include the files locally.

    Best regards

    would you mind share some code of your uikit implementation? sounds very interesting. if so, please pm me. thanks.

  7. 13 hours ago, Juergen said:

    Works also with UiKit calendar and Bootstrap calendar if you are using a framwork. If you are using UiKit calendar you can make fe a template which outputs all the calendar dates in a json array. Then you can load this template (or lets say the event dates) via ajax into the UiKit calendar template engine. Its very easy.

    @Juergen Sorry if I miss something, but where do you find a calendar component at Uikit (https://getuikit.com/docs/introduction)?

  8. hi horst,

    mac os (mamp). move has been done twice: 1. pull it off the server, import db, see if it works. 2. super-clean and fresh install, re-import db, replace templates folder, see if it works.

    i'll give the cache thing a try and report back.

    many thanks!

  9. Hi Forum,

    we moved an installation from the live server to localhost for further development. Unfortunately now PW doesn't find files in the /templates/ directory anymore (e.g. css, js and so on). Functions testing for existing files abort with an error and the console throws 404 for the files in question.

    Two developers have checked (so far several times):

    • site/config.php $config->httpHosts
    • .htaccess
    • file permissions on /templates/ and all subdirectories (set to 777 just to be on the safe side)
    • our own php functions

    Our version is 3.0.22 devns.

    We are running out of ideas. Any help is appreciated. Thanks.

×
×
  • Create New...