Jump to content

a-ok

Members
  • Content Count

    700
  • Joined

  • Last visited

Community Reputation

73 Excellent

About a-ok

  • Rank
    Hero Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I've attached some images. I'm assuming it's an LCN server issue but they've stated they don't limit/cap anything. Same file on localhost and a DigitalOcean server upload fine whereas on LCN it jumps to 600kb and effectively breaks the file.
  2. If I'm uploading a .mp4 (could potentially be any file) to a file upload field and the file is 3mb but on uploading the file is 600kb and then the .mp4 is glitchy/plays for only a few seconds (in the browser) is it safe to assume something wrong is set on the server? I've never had this issue before (use DigitalOcean, mainly) but I'm using LCN for a client and this issue has only just occurred since migrating from my dev to LCN. Any thoughts?
  3. I just fixed it. Turns out `sudo a2enmod rewrite` wasn't enabled 🤨FOUR HOURS LATER. Sorry for wasting everyone's time.
  4. I know these posts have been created a lot and I've trawled through a bunch and can't seem to find a solution for my current problem. I moved a PW site from my own DigitalOcean droplet > it's own Droplet and the homepage works fine but every other page gets stuck in a 301 redirect loop. I used curl to debug it a bit: curl http://159.65.162.128/products/ -vvv * Trying 159.65.162.128... * TCP_NODELAY set * Connected to 159.65.162.128 (159.65.162.128) port 80 (#0) > GET /products/ HTTP/1.1 > Host: 159.65.162.128 > User-Agent: curl/7.54.0 > Accept: */* > < HTTP/1.1 301 Moved Permanently < Date: Tue, 12 Nov 2019 12:03:55 GMT < Server: Apache/2.4.41 (Ubuntu) < Expires: Thu, 19 Nov 1981 08:52:00 GMT < Cache-Control: no-store, no-cache, must-revalidate < Pragma: no-cache < X-Powered-By: ProcessWire CMS < Set-Cookie: wire=de9ifnvlqr75l546fg66a1tkrd; path=/; HttpOnly < Upgrade: h2,h2c < Connection: Upgrade < Location: /products/ < Content-Length: 0 < Content-Type: text/html; charset=utf-8 < * Connection #0 to host 159.65.162.128 left intact And in the Network tab in Chrome it seems to just keep redirecting to the same page and then eventually errors out. My .htaccess file is exactly how it was on the other DigitalOcean droplet and I have no idea where to go to now. I don't have any SSL set up yet either so no modifications to any vhosts files. Any immediate thoughts or has anyone had this issue before?
  5. I changed the PHP version from 7.2 to 7.1 and the errors were 'silenced' based on the answer here > https://stackoverflow.com/questions/47700336/php-7-2-warning-cannot-change-session-name-when-session-is-active Is this something that should be reported on PW's Github?
  6. I'm getting the following errors on all pages of a site I've built. I had just cleared/deleted the sessions folder on the server which solved this but now it's come back. Any thoughts?
  7. Many thanks for this, @Mats var request = new Request(url, { headers: new Headers({ 'X-Requested-With': 'XMLHttpRequest' }) }); fetch(request) .then(response => response.text()) .then(data => { console.log(data); });
  8. Quick one. When using JS fetch() rather than jQuery's $.ajax, in my templates if (!$config->ajax) include $config->paths->templates . "head.inc"; seems to be ignored and it returns the head.inc in the response. Am I missing something?
  9. Page transitions etc and I guess barba is just an alternative to that. I see what you’re getting at but as I’d still have this issue with barba then the issue still stands 🙃
  10. Thanks! Yes I know barba.js but surely I’d have the same issue with updating menus/content outside of what’s changing?
  11. I'm looking for some best practice advice. A standard setup for me is to have a head.inc and a foot.inc and then everything in-between is updated via AJAX calls with some transition. Getting a bit boring but that's currently how it is. The issue I have is most of the time the main site nav/menu, which is in the head.inc, is contextual and will change based on the page being view. This can cause a lot of duplication of code as 1) I write it with PW in PHP so if the page is visited directly it is reflected and 2) I also have to do the same in JS if the page is visited via an AJAX call. You see the dilemma. What I've started to do recently is build a PHP array in an include file for the menu, and also `json_encode` it so I have an array, of the same code, one for PHP to use and one for the JS to use. Something like the below... $menuArray = array(); $menuLeft = $pages->find("template=work|news, sort=sort"); $menuRight = $pages->find("template=clients|about, sort=sort"); if ($page->id !== 1) { $menuLeft->filter("id={$page->id}"); $menuRight->filter("id={$page->id}"); } foreach ($menuLeft as $item) { $menuArray['left'][] = array( 'id' => $item->id, 'name' => $item->name, 'url' => $item->url, 'title' => $item->title, 'x' => '100%' ); // If current page then prepend 'Close' if ($page->template->name == $item->name) { array_push($menuArray['left'], array( 'name' => 'close', 'url' => $pages->get(1)->url, 'title' => 'Close', 'x' => '100%' )); } } foreach ($menuRight as $item) { $menuArray['right'][] = array( 'id' => $item->id, 'name' => $item->name, 'url' => $item->url, 'title' => $item->title, 'x' => '100%' ); // If current page then append 'Close' if ($page->template->name == $item->name) { array_unshift($menuArray['right'], array( 'name' => 'close', 'url' => $pages->get(1)->url, 'title' => 'Close', 'x' => '100%' )); } } // Return JSON for JS (PHP can grab $menuArray directly) $menuJSON = json_encode($menuArray); if ($config->ajax) { echo '<script id="menuJSON">'; echo "menuJSON = {$menuJSON}"; echo '</script>'; } Then in the head.inc loop through `$menuArray` and in the JS loop through, on AJAX changes, `menuJSON`. updateMenu: function(e) { var $header = document.querySelector('header.main'), headerContent = ''; for (var menu in menuJSON) { headerContent += '<ul class="menu --' + menu + '">'; menuJSON[menu].forEach(function(item) { headerContent += '<li data-template-name="' + item.name + '"><a data-ajax data-x="' + item.x + '>" href="' + item.url + '">' + item.title + '</a></li>'; }); headerContent += '</ul>'; } $header.innerHTML = headerContent; } The issue I'm having is I have no idea if this is the best way to work with something like this and wondered if anyone had any input? It also feels weird echo'ing out script tag with PHP then relying on the JS finding it in the DOM. You know? Anyway... I'll put this out there and see what happens 🙂
  12. Thanks, @Robin S The original is saved at JPEG quality 8 in Photoshop. Anything less than 100 in PW, in my experience, messes with the colours so always have to keep it at 100.
  13. Anyone? Am I wrong in thinking that the variations would be smaller in filesize? The original is 2000px wide so there’s no upscale.
  14. Not to my knowledge. I have this in my config.php file: $config->imageSizerOptions('sharpening', 'none'); $config->imageSizerOptions('quality', 100); $config->imageSizerOptions('defaultGamma', -1); And yes just a test 😉
  15. I'm resizing my images for img srcset using a helper function: function getSrcsetImages($image, $variations, $sizes) { $srcset = array(); if (empty($variations)) { $srcsetSizes = array(100, 200, 300, 400, 500, 640, 750, 828, 1024, 1125, 1242, 1280, 1400, 1500, 1600, 1700, 1800, 1920); } else { $srcsetSizes = explode(", ", $variations); } foreach ($srcsetSizes as $s) { if ($s <= ceil($image->width())) { $srcset[] = $image->width($s)->url() . " {$s}w"; } } $srcset = implode(", ", $srcset); echo "src=\"{$image->url}\" data-srcset=\"{$srcset}\" sizes=\"{$sizes}\""; } <img <?php getSrcsetImages($image, null, "auto"); ?> class="--lazy" /> This works in theory but in my assets folder why are the variations, on average, larger than the original? Feels like I should just use one image at this point? Any thoughts on what I'm doing wrong?
×
×
  • Create New...