Jump to content

POWERFULHORSE

Members
  • Posts

    45
  • Joined

  • Last visited

Posts posted by POWERFULHORSE

  1. I was using the repeaters to add variable content. Each repeater had a dropdown with options "Header", "Text", "Image". Selecting one would reveal a corresponding field. So the admin is able to add a varying number of different types of field in a custom order. Would I be right in saying PageTables create a new page for every "repeater"? I've just updated to the dev branch and tried to use PageTables, but it's asking for a title/name for every content section I want to add, which is not really what I want to do as I'm trying to add fields, not pages.

  2. Thanks for such a detailed writeup Ryan. I've been through almost every item on the server and it seems the problem was limited to that single php file in my case, but still a hugely helpful post that I will keep bookmarked. My initial hunch was that it wasn't PW that had been compromised, I'm now certain the problem was down to the shared hosting package the client is using.

    • Like 2
  3. Thanks for this Charles. It does indeed seem that the situation is what you've described in your post. The client's site is hosted on a shared hosting package and I'm assuming some other site has been compromised. I identified the problem as a single php file, "upgrade.php" that was in the root public_html folder, was around 6k. I deleted this and it seems to have fixed the problem. I'm assuming from this that it's not an issue with ProcessWire, as I know the WP/Joomla exploits inject code into locations/files specific to those installations.

    I'll keep an eye on it to make sure it doesn't return, and will get in touch with the webhost.

    Thanks again.

    • Like 1
  4. A site I manage has been compromised by the "pharma hack". I'm trying to determine if a vulnerability in ProcessWire has been exploited or if the problem is with the site's webhost, but not really sure where to start. Has anyone else come across this before?

  5. set_time_limit(300) did it. Could only load two more, but here's the output:

    Last image took 158 seconds to render!

     

    array(11) {
      [0]=>
      array(3) {
        [0]=>
        string(6) "0.0001"
        [1]=>
        string(6) "0.0880"
        [2]=>
        string(6) "0.0928"
      }
      [1]=>
      array(3) {
        [0]=>
        string(6) "0.0000"
        [1]=>
        string(6) "0.0338"
        [2]=>
        string(6) "0.0357"
      }
      [2]=>
      array(3) {
        [0]=>
        string(6) "0.0000"
        [1]=>
        string(6) "0.0454"
        [2]=>
        string(6) "0.0477"
      }
      [3]=>
      array(3) {
        [0]=>
        string(6) "0.0000"
        [1]=>
        string(6) "0.0879"
        [2]=>
        string(6) "0.0898"
      }
      [4]=>
      array(3) {
        [0]=>
        string(6) "0.0000"
        [1]=>
        string(6) "0.1946"
        [2]=>
        string(6) "0.1964"
      }
      [5]=>
      array(3) {
        [0]=>
        string(6) "0.0000"
        [1]=>
        string(6) "0.4132"
        [2]=>
        string(6) "0.4180"
      }
      [6]=>
      array(3) {
        [0]=>
        string(6) "0.0000"
        [1]=>
        string(6) "1.1618"
        [2]=>
        string(6) "1.1657"
      }
      [7]=>
      array(3) {
        [0]=>
        string(6) "0.0000"
        [1]=>
        string(6) "3.4625"
        [2]=>
        string(6) "3.4644"
      }
      [8]=>
      array(3) {
        [0]=>
        string(6) "0.0000"
        [1]=>
        string(7) "11.8296"
        [2]=>
        string(7) "11.8319"
      }
      [9]=>
      array(3) {
        [0]=>
        string(6) "0.0000"
        [1]=>
        string(7) "43.1316"
        [2]=>
        string(7) "43.1335"
      }
      [10]=>
      array(3) {
        [0]=>
        string(6) "0.0000"
        [1]=>
        string(8) "158.5707"
        [2]=>
        string(8) "158.5729"
      }
    }
    
  6. Hi horst, thanks for looking at this so quickly!

    The last two images that are taking ~3s and ~10s, the originals are only 450 x 600px (25kb) and 536 x 712px (74kb). They're no bigger than any of the other images, actually quite small compared to some others. Seems strange that each image is taking progressively longer to render?

    The process is also still taking this long even though the images aren't being recreated each time, they're all saved in the assets directory and aren't being overwritten as far as I can see.

    EDIT: Is this looking like it's something to with my server configuration? This is all happening on my local XAMPP server.

  7. Hhm, you are not looping through images but childpages. You may try to debug the times for the images rendering.

    Also you can do the resize to 320 and grayconvert in one step.

    <?php   
    $timerstotal = array();
    
    foreach ($page->children as $article) {
        ini_set('max_execution_time', 30);
        $timers = array();
        $timer = Debug::timer();
        $timers[] = Debug::timer($timer);  // start image rendering
        $bw = $article->cover_image->first()->pimLoad('bw320')->width(320)->grayscale()->pimSave();
        $timers[] = Debug::timer($timer);  // finished image rendering
    ?>
        <a class="archive-item" href="<?php echo $article->url; ?>">
            <div class="archive-item-img"><img class="archive-item-img-overlay" src="<?php echo $bw->url; ?>"></div>
            <div class="archive-item-text-container"><div class="archive-item-text">
            <?php
                echo "<div class='archive-item-title'>".$article->title."</div>";
                echo "<div>".$article->contributor->title."</div>";
            ?>
            </div></div>
        </a>
    <?php 
        $timers[] = Debug::timer($timer);  // none image stuff finished
        $timerstotal[] = $timers;
    } 
    
    // output timers
    echo "<pre>\n"; // or "<!-- \n" to output it as HTML comment 
    var_dump($timerstotal);
    echo "\n</pre>"; // or "\n-->\n";
    ?>
    

    Thanks for this horst, if I have more than 9 items in the loop it never actually executes the code which outputs the timings.

    Stripped it back to 9 items, this is the output:

    array(9) {
      [0]=>
      array(3) {
        [0]=>
        string(6) "0.0001"
        [1]=>
        string(6) "0.0243"
        [2]=>
        string(6) "0.0280"
      }
      [1]=>
      array(3) {
        [0]=>
        string(6) "0.0000"
        [1]=>
        string(6) "0.0150"
        [2]=>
        string(6) "0.0172"
      }
      [2]=>
      array(3) {
        [0]=>
        string(6) "0.0000"
        [1]=>
        string(6) "0.0250"
        [2]=>
        string(6) "0.0267"
      }
      [3]=>
      array(3) {
        [0]=>
        string(6) "0.0000"
        [1]=>
        string(6) "0.0484"
        [2]=>
        string(6) "0.0502"
      }
      [4]=>
      array(3) {
        [0]=>
        string(6) "0.0000"
        [1]=>
        string(6) "0.1159"
        [2]=>
        string(6) "0.1179"
      }
      [5]=>
      array(3) {
        [0]=>
        string(6) "0.0000"
        [1]=>
        string(6) "0.2891"
        [2]=>
        string(6) "0.2927"
      }
      [6]=>
      array(3) {
        [0]=>
        string(6) "0.0000"
        [1]=>
        string(6) "0.8478"
        [2]=>
        string(6) "0.8514"
      }
      [7]=>
      array(3) {
        [0]=>
        string(6) "0.0000"
        [1]=>
        string(6) "2.8584"
        [2]=>
        string(6) "2.8602"
      }
      [8]=>
      array(3) {
        [0]=>
        string(6) "0.0000"
        [1]=>
        string(7) "10.3439"
        [2]=>
        string(7) "10.3459"
      }
    }
    
  8. Sure thing:

    <?php foreach ($page->children as $article) {
    	$coverimage = $article->cover_image->first()->width(320);
    	$bw = $coverimage->pimLoad('bw')->grayscale()->pimSave()->url;
    	?>
    	<a class="archive-item" href="<?php echo $article->url; ?>">
    		<div class="archive-item-img"><img class="archive-item-img-overlay" src="<?php echo $bw; ?>"></div>
    		<div class="archive-item-text-container"><div class="archive-item-text">
    			<?php
    			echo "<div class='archive-item-title'>".$article->title."</div>";
    			echo "<div>".$article->contributor->title."</div>";
    			?>
    		</div></div>
    	</a>
    <?php } ?>
    
  9. Are there any known limits with this module?

    I'm trying to grayscale 10+ images on a single page using $image->first()->width(320)->pimLoad('bw')->grayscale()->pimSave()->url; and it ends up returning the first 9 images correctly, followed by this error:
    Error: Maximum execution time of 30 seconds exceeded

    This even occurs when the grayscaled images already exist, still getting a timeout. I've resorted to using file_exists() to check for the grayscaled images manually. If they don't it runs the code above, so with a few page refreshes atfer new image uploads I'm able to eventually have all the images converted.

    Any suggestions?

×
×
  • Create New...