Jump to content

jploch

Members
  • Posts

    347
  • Joined

  • Last visited

  • Days Won

    8

Posts posted by jploch

  1. @Robin S

    Thanks for your Help!
    The order was messed up, even when I echoed out the title.

    I found out that the order is correct when I change this line

    $albums = $pages->find("parent=/work/, template=project, thumbnail!='', sort=sort");

    to:

    $albums = $pages->find("parent=/work/, template=project, sort=sort");


    Now I only have one problem.
    I want to display all thumbnails, even when there are just 6.
    So it should be one slide with 4 and one with the remaining 2.

  2. @Robin S

    Thanks for your quick reply!
    Your code works better. The number of images is now correct, but the order is still not right.
    I want the images to be displayed in the order they are sorted in PW (so the user can sort them with dragging in the page tree).

    I also noticed that I can't login to the processwire backend, after I created the init.php file in my site directory.
    When I delete it, it works. Is there anything else I have to do? (Running PW 3.0.42.)

    Any suggestions?
    With my own code I felt more confident because I can understand better how it works, even if it may be bad practise.

  3. Hi!

    I have a problem with pagination.
    My site structure is like this:
    – Work
        – Project 1
        – Project 2
        – Project 3

    Every project-page has a thumbnail I want to display.
    I have a slider that creates pagination automatically with a structure like <div id="slide1"></div>, <div id="slide2"></div>, etc.
    I want to have 4 thumbnails per slide.

    My problem is, that the order and number of images is messed up.
    Here is my code:

    function albumList(){
     
        // Get the list of albums 
        $albums = wire("pages")->find("parent=/work/, template=project, sort=sort");
      $albums_total = wire('pages')->get("/work/")->numChildren;
      $images_per_page = 4;
      $slides = round($albums_total / $images_per_page);
     
     //Create Slides
        for($i = 0; $i < $slides; $i++) {
      
      $start = ($i) * $images_per_page;
      $slide_id = $i + 1;
      $images_limited = $albums->slice($start, $images_per_page);
      
      echo ("<div class='slide' id='slide{$slide_id}'><div class='grid'>");
     
        //Display Images
        foreach($images_limited as $album) {
    
            // if there's no thumbnail no need to do anything
            if(!$album->thumbnail) continue;
    
            // save srcset tag to a variable
            $bgset = $album->thumbnail->bgset('half', 'lazyload item size1of2', array('quality' => 70));
    
            $out .="<a href='{$album->url}' $bgset><img src='site/templates/img/plus-icon.svg' class='info-button'>";
            $out .="<div class='item-info'><div class='info-container-center'><h3>{$album->thumbnail->tags}</h3><h2>Für {$album->title}</h2><p>{$album->thumbnail->description}</p></div></div>";
            $out .="</a>";
            echo $out;
        }
        
        echo ("</div></div>");
        
        }
        
    }

    Any help would be highly appreciated!
    Thx!

  4. 12 hours ago, horst said:

    @jploch: a question from me to clarify:

    • You have installed ImageAnimatedGif module and
    • it produces correct resized and animated variations with calls to pageimage methods (widt, height, size),
    • but it doesn't produce the same result when you use it with MarkupSrcSet?

    The ImageAnimatedGif hooks into before pageimage resize, and MarkupSrcSet simply calls pageimage size, so I'm wondering what could be the difference here?

    What is the result of MarkupSrcSet? Images are scaled down and animated, but with artefacts? Can you provide an example? (a variation from direct call to pageimage and one result from MarkupSrcSet)

    Thanks for your quick reply!

    Here is my code example (shortened) without MarkupSrcSet and with ImageAnimatedGif installed:

     $image->width(300);
    echo ="<img src='{$image->url}'>";

    Result:

    animation_resize.gif

     


    code example with MarkupSrcSet and ImageAnimatedGif installed:

    $srcset = $image->srcset('thumbnail', 'inline-block', array('quality' => 70));
    echo ="<img $srcset>";

    Result:

    animation_srcset.gif

  5. For a website Iam working on, I tried to use this module with animated gif's.
    I know that PW doesn't support resizing animated gif's out of the box, so I also installed the "Image Animated Gif Module".

    Now the gif's are animated but have strange artifacts and colors.
    When I resize them with PW like "$image->width(320)" they are fine.

    Is there anyone having the same problem?
    Would be awesome to use this module for all my images!

    THX!

  6. 20 hours ago, adrian said:

    @jploch - I'd like to see a dump of $event after line 718 because $field is not an object and it should be.

    That said, a quick fix might be to change the hook on line 97 to:

    
    InputfieldImage::processInputFile

     

    Thx! this fixed it for me

    • Like 1
  7. hi!
    thanks for this great module!

    today I experienced a strange issue when using this module with the Video Fieldtype Module
    I get the following error when uploading a video, when the image extra module is installed:

    <br />
    <b>Notice</b>:  Trying to get property of non-object in <b>/www/htdocs/w00dd152/projekte/jp-relaunch/site/modules/ImageExtra/ImageExtra.module</b> on line <b>722</b><br />
    [{"error":false,"message":"Added file: portfolio_screencap_02.mp4","file":"\/jp-relaunch\/site\/assets\/files\/1162\/portfolio_screencap_02.mp4","size":3214711,"markup":"<li id='file_c17b44756649023a42ba014c5b29202c' class='InputfieldFile InputfieldImage InputfieldVideo ui-widget'>\n\t\t<p class='InputfieldFileInfo ui-widget ui-widget-header'>\n\t\t\t<span class='ui-icon ui-icon-arrowthick-2-n-s'><\/span>\n\t\t\t<span class='InputfieldFileName'>portfolio_screencap_02.mp4<\/span> \n\t\t\t<span class='InputfieldFileStats'>• 3,139 kB • <\/span> \n\t\t\t<label class='InputfieldFileDelete'><input type='checkbox' name='delete_video_repeater1162_c17b44756649023a42ba014c5b29202c' value='1' \/><span class='ui-icon ui-icon-trash'>Delete<\/span><\/label>\n\t\t\t<a class='InputfieldFileMove InputfieldFileMoveBottom' href='#'><span class='ui-icon ui-icon-arrowthickstop-1-s'><\/span><\/a> \n\t\t\t<a class='InputfieldFileMove InputfieldFileMoveTop' href='#'><span class='ui-icon ui-icon-arrowthickstop-1-n'><\/span><\/a> \n\t\t<\/p>\n\t\t\t<div class='InputfieldFileDescription'><label for='description_video_repeater1162_c17b44756649023a42ba014c5b29202c' class='detail'>Description<\/label><input type='text' name='description_video_repeater1162_c17b44756649023a42ba014c5b29202c' id='description_video_repeater1162_c17b44756649023a42ba014c5b29202c' value='' \/><\/div>\n\t\t<br \/><label class='InputfieldFileDescription'><span class='detail'>Subtitles<\/span>\n\t\t<br \/><br \/>In templates, you can access this subtitles file (portfolio_screencap_02.srt) using: <code>$page->video->eq(0)->subtitles<\/code><br \/>In templates you can access a formatted transcript (converted from subtitles entered in SRT format), by using: <code>$page->video->eq(0)->transcript<\/code>\n\t\t<br \/><br \/><textarea rows='10' name='subtitles_video_repeater1162_c17b44756649023a42ba014c5b29202c' \/><\/textarea>\n\t\t\t<input class='InputfieldFileSort' type='text' name='sort_video_repeater1162_c17b44756649023a42ba014c5b29202c' value='0' \/>\n\t\t<\/p><\/li>","replace":false,"overwrite":0}]

    I testes this in PW 3.0 with the newest versions of both modules installed.
    Not sure why its even interfering with the video field..
    When I disable the image extra module, everything works fine.

  8. 9 minutes ago, adrian said:

    @jploch - you need to dig a little deeper - we need to see the Response tab for the file that results in error - there will be an error message in the returned response that is breaking the upload.

    Sorry Iam not sure how to see the response tab in chrome (more designer, than developer, but Iam learning).

    On the source tab I get this error. Maybe this helps?

    <br />
    <b>Notice</b>:  Trying to get property of non-object in <b>/www/htdocs/w00dd152/projekte/jp-relaunch/site/modules/ImageExtra/ImageExtra.module</b> on line <b>722</b><br />
    [{"error":false,"message":"Added file: portfolio_screencap_02.mp4","file":"\/jp-relaunch\/site\/assets\/files\/1162\/portfolio_screencap_02.mp4","size":3214711,"markup":"<li id='file_c17b44756649023a42ba014c5b29202c' class='InputfieldFile InputfieldImage InputfieldVideo ui-widget'>\n\t\t<p class='InputfieldFileInfo ui-widget ui-widget-header'>\n\t\t\t<span class='ui-icon ui-icon-arrowthick-2-n-s'><\/span>\n\t\t\t<span class='InputfieldFileName'>portfolio_screencap_02.mp4<\/span> \n\t\t\t<span class='InputfieldFileStats'>• 3,139 kB • <\/span> \n\t\t\t<label class='InputfieldFileDelete'><input type='checkbox' name='delete_video_repeater1162_c17b44756649023a42ba014c5b29202c' value='1' \/><span class='ui-icon ui-icon-trash'>Delete<\/span><\/label>\n\t\t\t<a class='InputfieldFileMove InputfieldFileMoveBottom' href='#'><span class='ui-icon ui-icon-arrowthickstop-1-s'><\/span><\/a> \n\t\t\t<a class='InputfieldFileMove InputfieldFileMoveTop' href='#'><span class='ui-icon ui-icon-arrowthickstop-1-n'><\/span><\/a> \n\t\t<\/p>\n\t\t\t<div class='InputfieldFileDescription'><label for='description_video_repeater1162_c17b44756649023a42ba014c5b29202c' class='detail'>Description<\/label><input type='text' name='description_video_repeater1162_c17b44756649023a42ba014c5b29202c' id='description_video_repeater1162_c17b44756649023a42ba014c5b29202c' value='' \/><\/div>\n\t\t<br \/><label class='InputfieldFileDescription'><span class='detail'>Subtitles<\/span>\n\t\t<br \/><br \/>In templates, you can access this subtitles file (portfolio_screencap_02.srt) using: <code>$page->video->eq(0)->subtitles<\/code><br \/>In templates you can access a formatted transcript (converted from subtitles entered in SRT format), by using: <code>$page->video->eq(0)->transcript<\/code>\n\t\t<br \/><br \/><textarea rows='10' name='subtitles_video_repeater1162_c17b44756649023a42ba014c5b29202c' \/><\/textarea>\n\t\t\t<input class='InputfieldFileSort' type='text' name='sort_video_repeater1162_c17b44756649023a42ba014c5b29202c' value='0' \/>\n\t\t<\/p><\/li>","replace":false,"overwrite":0}]

     

  9. Thanks for the quick reply!
    Here is the error: 

    Uncaught SyntaxError: Unexpected token < in JSON at position 0
        at JSON.parse (<anonymous>)
        at Function.parseJSON (JqueryCore.js?v=1487348736:2)
        at XMLHttpRequest.<anonymous> (InputfieldFile.js:256)
    parseJSON @ JqueryCore.js?v=1487348736:2
    (anonymous) @ InputfieldFile.js:256

     

     

  10. Hey!
    Thank you for this module!
    It worked fine for me with PW 2.6. without ffmpeg.

    Now Iam working on a website running PW 3.0 and when I upload a video (mp4) it keeps loading even when it reaches 100% and the upload will not complete.
    The same video is working and uploading just fine with PW 2.6.

    Iam not sure if this is working with PW 3.0. so it would be great if someone could confirm this.

  11. 9 minutes ago, Mike Rockett said:

    Very nice site indeed. My only issue is with regards to the floating blocks - they float over the text, which means I have to scroll very specifically for the block to move past the text, but not so much that the text scrolls out of view. This would be less prominent on a 1080p screen, but more prominent on a common 1366x768 screen. Other that that, it's very well composed and designed. :)

    you have a point here. Its still possible to read it thought. On smaller screen sizes I may have to hide those elements.

    • Like 1
  12. 03_01_wohnungen.png

    Hey guys,

    Just launched a new project called Fabricius:
    fabriciusstrasse31.de

    Fabricius is a new building thats being built in Hamburg (Germany), that offers modern living comfort in a green environment. 
    I developed the whole brand strategy and visual identity for the website and some printing materials. 
    The logo mark is derived from the silhouette of the building, which is surrounded by trees (circular shapes) and green areas.
    More details here

    The website is build with PW 3.0 and uses Modules like Map Marker, Pages2PDF (to generate the apartment exposes) and MarkupSrcSet.
    Thanks for the awesome support here and the development of PW and the modules!!
      

    • Like 14
  13. 16 minutes ago, adrian said:

    If everyone has the same login username, then absolutely - that is what the session login throttle is designed to do. I think your quickest solution will be to disable the SessionLoginThrottle module.

    Just wanted to get that option to you quickly - I'll post some better solutions in a minute.

    I just testet it and now it seems to work fine!
    Thanks for your support! 
    I have deactivated the SessionLoginThrottle module. Is this bad for security reasons or is it save to leave it deactivated?

  14. could this be a problem with to many people logging in at the same time?
    The customer had send a newsletter with the frontend Login, so there could be multiple people accessing the login at the same time.
    Also the error happened everytime the customer or I  tried to login.

  15. 7 minutes ago, adrian said:

    Silly question, but are you using the same username on frontend and admin logins?

    What happens if you wait 35 seconds - can you then login successfully?

    Any sign of weirdness in your session_login_throttle database table? Perhaps you could empty that table?

    Thx for your quick reply!
    For the frontend I created a new user with just the guest role assigned.
    I can't test the Login right now, I had to disable the page protection, because the website is live and the customer is a little nervous right now :)
    I will test it later in the evening. 

    Iam still a newbi. Where can I find the session_login_throttle database table and how can I empty it? 

  16. I use this on a site. It used to work fine. Now when I login on the frontend, I get this error with debug on:

    Fatal error: Exception: Please wait at least 35 seconds before attempting another login. (in /kunden/348019_70794/rp-hosting/14027/64026/fabriciusstrasse/wire/modules/Session/SessionLoginThrottle/SessionLoginThrottle.module line 97) #0 /kunden/348019_70794/rp-hosting/14027/64026/fabriciusstrasse/wire/modules/Session/SessionLoginThrottle/SessionLoginThrottle.module(65): ProcessWire\SessionLoginThrottle->allowLogin('kunde') #1 /kunden/348019_70794/rp-hosting/14027/64026/fabriciusstrasse/wire/core/WireHooks.php(619): ProcessWire\SessionLoginThrottle->sessionAllowLogin(Object(ProcessWire\HookEvent)) #2 /kunden/348019_70794/rp-hosting/14027/64026/fabriciusstrasse/wire/core/Wire.php(373): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Session), 'allowLogin', Array) #3 /kunden/348019_70794/rp-hosting/14027/64026/fabriciusstrasse/wire/core/Session.php(712): ProcessWire\Wire->__call('allowLogin', Array) #4 /kunden/348019_70794/rp-hosting/14027/64026/fabriciusstrasse/wire/core/Session.php(712): ProcessWire\Session->allowLogin( in /kunden/348019_70794/rp-hosting/14027/64026/fabriciusstrasse/index.php on line 64

    Error: Exception: Please wait at least 35 seconds before attempting another login. (in /kunden/348019_70794/rp-hosting/14027/64026/fabriciusstrasse/wire/modules/Session/SessionLoginThrottle/SessionLoginThrottle.module line 97)

    #0 /kunden/348019_70794/rp-hosting/14027/64026/fabriciusstrasse/wire/modules/Session/SessionLoginThrottle/SessionLoginThrottle.module(65): ProcessWire\SessionLoginThrottle->allowLogin('kunde')
    #1 /kunden/348019_70794/rp-hosting/14027/64026/fabriciusstrasse/wire/core/WireHooks.php(619): ProcessWire\SessionLoginThrottle->sessionAllowLogin(Object(ProcessWire\HookEvent))
    #2 /kunden/348019_70794/rp-hosting/14027/64026/fabriciusstrasse/wire/core/Wire.php(373): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Session), 'allowLogin', Array)
    #3 /kunden/348019_70794/rp-hosting/14027/64026/fabriciusstrasse/wire/core/Session.php(712): ProcessWire\Wire->__call('allowLogin', Array)
    #4 /kunden/348019_70794/rp-hosting/14027/64026/fabriciusstrasse/wire/core/Session.php(712): ProcessWire\Session->allowLogin(

    This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged.

     

  17. I think a have a problem related to this.
    Iam running PW 3.0 and loading content from a php file, that is located at my site root, into one of my template files (under site/templates).

    So in my PHP File I have this (like Ryan suggested):

    include('./index.php');  // bootstrap ProcessWire

    So this works now:

    <img src="<?php echo $config->urls->templates?>img/image.png">

    But when I try to save pages in an array like this for example:

    $wohnungen = wire("pages")->find("parent=/wohnen/, template=wohnungen, sort=sort");

    I get this Error:

    Error: Call to undefined function wire() (line 8 of /www/htdocs/w00dd152/projekte/fabricius/wohnungen.php) 

    Any Ideas?

    I figured it out. I had to use

    $wohnungen = $wire->pages->find("parent=/wohnen/, template=wohnungen, sort=sort");

     

  18. Now I have a new Problem.
    I have several pages I just use for data storage (no template file associated).
    The pages are all children of a page called "wohnen". 
    The data of those pages is used on the page home.

    Now I want to create a PDF from all these pages (of parent "wohnen").
    To let the module know wich PDFs to generate I used a session.
    In my template for generating the PDFs I have something like this:

    session_start();
    $wohnungsnr = $_SESSION['wohnungsnr'];
       <?php    
        $targetPage = "/$wohnungsnr/";
        $wohnung = wire('pages')->get($targetPage);
    	$out = " <h1>{$targetPage}</h1> ";
       
        
            $out .="
             <div id='{$wohnungsnr}-content' class='fbox-content'>
                 <div class='grid'>
                    <h1 class='size1of1'>{$wohnung->headline}</h1>
            ";
    		 foreach ($wohnung->grundrisse as $grundriss) {
     $out .=  "<img class='size1of3' src='{$grundriss->url}'>";
    };
            $out .= 
                "
                <div class='size1of3 wohnung-content'>
                <table>
                <tr>
                                <th>Wohnungstyp</th>
                                <th>Etage</th>
                            </tr>
                            <tr>
                                <td>{$wohnung->options_zimmer->title} Zimmer</td>
                                <td>{$wohnung->options_etage->title}</td>
                            </tr>
                            <tr>
                                <th>Grösse</th>
                                <th>Kaufpreis</th>
                            </tr>
                            <tr>
                                <td>{$wohnung->size}</td>
                                <td>{$wohnung->preis}</td>
                            </tr>
                            <tr>
                            <th colspan='2'>Ausstattung</th>
                            </tr>
                            <tr>
                                <td colspan='2'>
                                    <ul>
                ";
            foreach ($wohnung->ausstattung_repeater as $item) {
                
                $out .= " 
                                        <li>– {$item->headline}</li>
                                    ";
            }
            $out .= "</ul>
                                </td>
                            </tr>
                </table>
                
                </div>
                 </div>
                </div> ";
    	echo "{$out}";
        ?>
    
    
    <?php include("_footer.php"); ?>

    On the page home I have a function that shows all the data from the children of  the"wohnen" page with a download button for every page. My Idea was to change the session variable on click of the download buttton to let the pdf template know wich page to render.
    Any Ideas how this works?


    You can delete this post I figured it out.
    I send the variable with the URL like this:

    <a href='$page->url?pages2pdf=1&wohnungsnr={$wohnung->title}' class='button' id='{$wohnung->title}'><img src='http://projekte.janploch.de/fabricius/site/templates/img/icon-download.svg' class='button-icon'>Download Exposé</a>


     

  19. Hi!
    Thanks for this great module!

    This is probably easy, but I cant get it to work (Iam a PHP noob). 
    I want to generate two PDfs (with different templates) from the same page.

    I have two files in the pages2pdf folder under templates (expose_preisliste.php, expose_wohnung.php).
    If I understand correctly I would set it up like this:

    $preisliste = $modules->get('WirePDF');
    $preisliste->markupMain = $config->paths->templates . 'expose_preisliste.php';
    $preisliste->save('preisliste.pdf');
    
    $wohnung = $modules->get('WirePDF');
    $wohnung->markupMain = $config->paths->templates . 'expose_wohnung.php';
    $wohnung->save('wohnung.pdf');

    Now I want two links on the frontend to download the files.
    How do I call the variable for the Link?
    I want the PDFs to be generated when clicking the link.

    Thx for your help!

    I managed to get this working. 
     

  20. On 26.8.2016 at 11:18 PM, Robin S said:

    Also, the $options array is something that applies to the map as a whole. It allows you to set a single custom icon to be used across the whole map. I don't think the module provides support for setting different icons to different individual markers.

    Thanks for your reply. You are right the icon variable only allows a single value.
    The post from nghi helped me to get it working with custom icons for each marker.

    Here is the code I used in the MarkupGoogleMap.module:

    /** Custom Fields */
    		foreach($pageArray as $page) {
    $marker = $page->get($fieldName); 
    if(!$marker instanceof MapMarker) continue; 
    if(!$marker->lat) continue; 
    $url = $options['markerLinkField'] ? $page->get($options['markerLinkField']) : '';
    $title = $options['markerTitleField'] ? $page->get($options['markerTitleField']) : '';
    $icon = $page->marker_icon->url ? $page->marker_icon->url  : '';
    $map_location_name = $page->map_location_name ? $page->map_location_name  : '';
    $out .= "$id.addMarker($marker->lat, $marker->lng, '$url', '$title', '$icon', '$map_location_name'); ";
    }

    Maybe this will help someone.

    • Like 3
  21. Hey folks!

    I managed to get this working with multiple markers (using a repeater).
    Following this thread, I even got the hoverBox with a custom field working. 

    Only Problem I have now, is that I need different icons for each marker.
    With my noob developer skills I can't get it to work.

    Here is what I tried:

    <?php
        $map = $modules->get('MarkupGoogleMap'); 
        $options = array(
        'height' => '100%',
        'width' => '100%',
        'icon' => '$page->map_repeater->marker_icon->url',
    );
          $items = $page->map_repeater;
    echo $map->render($items, 'map', $options); 
                     ?>

    "marker_icon" is an image field in the repeater I want to use for the Icons.
    Can someone please help me with this?
    Thanks for this awesome module btw.!

  22. is it possible to use an image filed for the markers instead of the fontawesome option?
    my code looks like this (it works with the FontIconPicker):
     

    <?php
        $options = array(
        'height' => '100%',
        'markerIconColour' => 'black',
        'popupFormatter' => function($page) {
            $out[] = "<p>$page->headline</p>";
            return implode($out);
        },
        'markerFormatter' => function($page, $marker_options) {
            $marker_options['icon'] = $page->marker_icon; // Override the default icon for this marker.
            return $marker_options;
        }
    );
          $items = $lage->map_repeater; 
    echo $map->render($items, 'map', $options); 
                     ?>

     

    • Like 1
×
×
  • Create New...