Jump to content

patricktsg

Members
  • Posts

    31
  • Joined

  • Last visited

Posts posted by patricktsg

  1. Nice one, maybe for gif's you could just resize front end with an inline style.

    Not sure if it's possible but if the file type selected and uploaded was a .gif then use the conditional display in the PW admin to show fields for setting a width / height and just output those params in the style

     

     

  2. Something probably off with my loop, the code below is on my "entries.php" template page, it's outputting the title and description of each entry fine but the repeater fields just repeats the first set of images from entry 1 throughout the loop.

     

    <?php
    // Functions
    
      $entries = $page->children;
      $entry_array = array();
      $image_array = array();
      
      foreach ($entries as $entry) {
        
        // Define the fields wanted
        $title = $entry->title;
    
        $description = $entry->entry_description;
    
        $images = $entry->images;
        foreach ($images as $image) {
            $imageUrl = $image->url; // make a thumb version
            $imageDescription = $image->description;
            // Build array from repeater
            $image_array[] = array(
                'image_url' => $imageUrl,
                'image_description' => $imageDescription,
            );
        }
    
        $pageUrl = $entry->httpUrl;
    
        // Build the array from the fields
        $entry_array[] = array(
              'title' => $title, 
              'description' => $description,
              'images' => $image_array,
              'page_url' => $pageUrl,
            );
      }
      
      // Json encode the array
      $entries = json_encode($entry_array, true);
      // Dump the data
      // echo $data;  
    
    ?>

     

×
×
  • Create New...