Jump to content


  • Posts

  • Joined

  • Last visited

About phil_s

  • Birthday March 1

Profile Information

  • Gender
  • Location
    Vienna, Austria

Recent Profile Visitors

2,387 profile views

phil_s's Achievements

Jr. Member

Jr. Member (3/6)




Community Answers

  1. Dummy question here: If I wanted the plugin to add a specific player parameter to all youtube shortlinks (e.g. enablejsapi=1) where would be the best place to add this? I changed line 170 to: "&format=json&maxwidth={$this->maxWidth}&maxheight={$this->maxHeight}&enablejsapi=1&html5=1"; but since the oembed?url gets rewritten by youtube I'm not sure this is working. Any pointers? Cheers guys!
  2. Thanks again guys, Just a quick update for anybody else who might run into this. Simply filtering out these: RewriteCond %{REQUEST_URI} !\.(cgi|pl|asp|rar|zip)$ [NC] RewriteCond %{REQUEST_URI} !wp-.*\.php$ [NC] ...took care of my problems. (No more crashes too) Cheers!
  3. Exactly what I needed... have only been cross-reading but: very interesting article with lots of hands on information, thanks a bunch!
  4. Hey there, A friend's server (php, to be exact) is now going down rather frequently (still irregular but almost every week), and I am trying to get to the bottom of it. It's a serverpilot configured small to middle tier DO Ubuntu server, running php 7 on nginx, https only, (with a letsencrypt certificate added manually by me, not via serverpilot) When looking through the various log files I found a couple of things I couldn't place, can you guys make anything of this? This happens multiple times a day (form different IPs) and goes on for 40-50 pings: - - [07/Mar/2017:01:02:27 +0100] "POST / HTTP/1.0" 301 229 - - [07/Mar/2017:01:03:13 +0100] "POST / HTTP/1.0" 301 229 - - [07/Mar/2017:01:03:59 +0100] "POST / HTTP/1.0" 301 229 - - [07/Mar/2017:01:04:45 +0100] "POST / HTTP/1.0" 301 229 - - [07/Mar/2017:01:05:32 +0100] "POST / HTTP/1.0" 301 229 - - [07/Mar/2017:01:06:19 +0100] "POST / HTTP/1.0" 301 229 - - [07/Mar/2017:01:07:05 +0100] "POST / HTTP/1.0" 301 229 .... Is this suspicious? (nobody was editing the site at this time) And these here come in 2-10 sec intervals, usually in 2-3 minute bursts, from different IPs, sometimes multiple times a day, sometimes followed by 30-40 "POST" commands - - [06/Mar/2017:16:40:53 +0100] "GET /wp-login.php HTTP/1.0" 301 245 - - [06/Mar/2017:16:40:58 +0100] "GET /wp-login.php HTTP/1.0" 301 245 - - [06/Mar/2017:16:41:03 +0100] "GET / HTTP/1.0" 301 233 While this should by no means get the server to it's knees (or should it?) this is not normal, right? Cheers folks!
  5. Hi foks (Not sure if this would make more sense in the dev forum, feel free to move if necessary...) I am trying to do the following... In $page->introtext (a textfield with markdown parser) 1. find the link in which the href matches my $current_urlsegment var 2. Change the href to $link_to_overview 3. Add a ".active" CSS class to it 4. Get the whole thing back into the array 5. Output the array. To add a bit of context: - This is for a text that contains links to segments of a page. When a user clicks on a link (selects a segment), the surrounding text is faded out, and the selected link turns into a "back to overview" button, so to say. (Sounds even more insane, but could work quite intuitively in practice) - So far, I did all of this with js, using a custom data attribute with the current segment to match against the links, but long story short it would be much easier if no js would be involved. As far as I understand it should be rather simple to do this with regex, but I'm struggling with the logic of it. I started with the following: $text = $page->txt_projects_intro; $currentsegment = '/projects/' + $sanitizer->pageName($input->urlSegment1) + '/'; $reg_ex_anchor = '/<a [^>]*\bhref\s*=\s*"\K[^"]*' + $currentsegment + '[^"]*/'; $reg_ex_onlyanchorpath = '[^>]*\bhref\s*=\s*"\K[^"]*' + $currentsegment + '[^"]*'; if(preg_match($reg_ex_anchor, $text, ...)) { $content .= preg_replace... // brain melts } Which is when I realized that I have now googled myself way out of my coding league So: Is the above going into the right direction? Is there an easier way, maybe even involving PW selectors that I don't know about? Cheers Guys!
  6. Makes sense, thanks for the detailed explanation! Can you elaborate on what the profile check / assign @line 214/215/216 does? Is this only for checking if the image profile is Grayscale? What caught my eye initially in the brasseur guide was the following part, at the end of the gamma section: This would imply that there is a more accurate and I would guess more convenient way to do the whole conversion dance? This sounds perfectly reasonable, except for the ubiquitous "don't use save for web" caveat. "Save for web" removes the EXIF data, removes attached image profiles, reduces the image to 8bit if >8bit, and converts it to sRGB. You could create an action that does this for you, except save for web is much easier to explain to clients. FWIW since we're comparing notes: I'm using Lightroom/CaptureOne for basic corrections, further edits / archival files are 16 Bit .tiffs rendered in prophoto RGB/Adobe RGB depending on the source, which I manually convert so srgb (usually since I want to control the rendering intent of the conversion), before using "save for web" with neither "convert to srgb" nor "embed profile" checked, which leaves me with a clean jpg with no profiles or meta data embedded/attached. (I use itpc for tagging and cataloging and I don't want these to show up in the web version). Very true. This also means that with GD, any image NOT converted to sRGB will still be interpreted as such. If you forget to do this with wide gamut profiles (e.g. Prophoto) it will lead to quite funky effects
  7. What are your experiences with profile/color consistency when using Image Magick for resizing? I know @horst is probably the person with the most experience on this, (hope you can chime in here Horst) Problem: I noticed that In some cases Image Magic resized jpgs appear darker than the original, and after some digging it appears to involve various factors concering both the image preparation (Photoshop's save for web and even general profile handling before that) and the way the Image Magic resizing process is setup. - Images with an embedded (srgb) profile that were exported via Photoshop's "save for web" function with "convert to srgb" and "embed profile" ON, somehow result in muted colors and a darker image, (actually it looks very much like when you would assign an srgb profile to an image that was already converted to srgb before, not dramatic, but quite noticeable with e.g. reds and cyans.) - I tried multiple variations, with embedded and excluded srgb profile, "convert to srgb" on and off, but the result appears to be the same darker, muted image. Need to find time to do more structured testing though.. Possible causes: - The way the srgb profile is embedded in the jpg - The way the Imagick module detects/ignores profiles - Colorspace handling changes between imagick versions - One of the above plus these rather involved technical reccomendations (tldr: convert to linear RGB, resize, convert back) http://www.4p8.com/eric.brasseur/gamma.html#ImageMagick http://www.imagemagick.org/Usage/resize/#resize_colorspace Would be nice to get a discussion going here. I am out of my league with this, technical knowledge wise but I'll try to keep up Cheers guys, Phil
  8. While looking for a way to add target="_blank" to markdown formatted fields I came across these little gems in the TextformatterMarkdownExtra.module (in the wire>modules>textformatter folder, I'm running v3.0.33). Turns out someone (Ryan? Did you add this?) already thought of it: /** * A couple RCD extentions to MarkDown syntax, to be executed after Markdown has already had it's way with the text */ protected function markdownExtensions(&$str) { // add id attribute to a tag, when followed by a #myid if(strpos($str, '>#')) $str = preg_replace('/<([a-z][a-z0-9]*)([^>]*>.*?)(<\/\\1>)#([a-z][-_a-z0-9]*)\b/', '<$1 id="$4"$2$3', $str); // add class attribute to tag when followed by a .myclass if(strpos($str, '>.')) $str = preg_replace('/<([a-z][a-z0-9]*)([^>]*>.*?)(<\/\\1>)\.([a-z][-_a-z0-9]*)\b/', '<$1 class="$4"$2$3', $str); // href links open in new window when followed by a plus sign, i.e. [google](http://google.com)+ if(strpos($str, '</a>+')) $str = preg_replace('/<a ([^>]+>.+?<\/a>)\+/', '<a target="_blank" $1', $str); // strip out comments // if(strpos($text, '/*') !== false) $text = preg_replace('{/\*.*?\*/}s', '', $text); // if(strpos($text, '//') !== false) $text = preg_replace('{^//.*$}m', '', $text); } Adding: $f->addOption(self::flavorRCD, 'RCD extentions'); after line 107 of the file, adds an option field which you can handily check from the module's config screen in the admin. Now, the question I should have asked before doing this is: Does changing that have any detrimental effect on things I don't know about yet? : ) Would be great if someone with actual knowledge on this could chime in before I shoot myself in the foot (There must be a reason why this is not active by default?) Cheers guys! Phil
  9. Sorry, I should have been more specific. What I meant to ask was: It would be interesting to hear how other people manage their PTE pages when they're not direct children. In my case choosing a custom (hidden from the client) parent for the layout would indeed be less confusing, but it would also mean that under the custom parent, all layout blocks (hundreds) from all projects would be listed without any context right? Not that the context is needed there, just need to get the OCD in check I guess..
  10. Oh, nice It seems reading the manual helps as usual. Sorry. @Robin S How do you keep order without the context of the parent? (assuming you are using PTE for a similar setup)? Thanks a bunch guys!
  11. Just wondering why you would need to do this... I use PTE as a visual editor for modular layout blocks in a project page template of a Portfolio website. The client can create and arrange blocks with various configurations to build the individual project pages. The blocks will get added as children of the project page. The page tree thus looks something like this: home + projects + first project + block-fullwidth + block-fullwidth + second project + block-twohalves + block-fullwidth ... In theory the obvious benefit of using PTE here is that the client can do all the arranging (which is more of a try this and that process) directly in the interface, and preview which order they will appear in the page in in a visual way. In practice though, when I fill the array and specify a sort order for rendering like this: $blocks = $page->children('sort=sort') ..this will render the (manual) sort order from the page tree, not the manual sort order arranged by the client via the PTE interface. I can rearrange the blocks in both views individually and access the page tree custom sort order e.g. via the above–but can't access PTE's sort order. So TLDR: I would like to access and render the custom sort order done via the PTE fields, not a custom sort order done via the page tree. Am I looking at this the wrong way or missing anything? Should I fill the array with find/get instead? Cheers guys!
  12. @MadeMyDay Looking forward indeed! Such an amazing module. Running smoothly on ProcessWire 3.0.30 devns here btw. One small quibble: How would you get the sort order from the drag and drop view of the module to correlate to the child pages in the tree view? As Jens pointed out, it seems there is currently no possibility to sync these two up or render/access the module's custom sort order? Cheers! Phil
  13. This works indeed! (telnet localhost 3000 connects..) Hum.. # iptables -L -n works, but there is no listing for a port 3000. So it should not be blocked? I also tried: curl -s localhost:3000 >/dev/null && echo Connected. || echo Fail. which results in "connected" Thanks Francesco!
  14. Hi guys, I have replicated my local gulp workflow on a digitalocean droplet, and I can't seem to get browsersync to work. Has anybody tried this before and can chime in? My PW install is at http://clients.domain.com/clientname/ In there, my folder setup looks like this, so gulp runs from the /templates folder: clients + public + clientname + site + templates + node_modules + gulpfile.js + package.json + src/ + assets/ I tried all kinds of shenanigans including leaving out any proxy settings, setting a proxy, different port and fiddling with the scriptPath options... gulp.task('browser-sync', function(){ browserSync.init({ scriptPath: function (path, port, options) { return options.getIn(['urls', 'external']) + path; } }); }); // or this: gulp.task('browser-sync', function(){ browserSync.init({ host: 'XX.XX.XX.XX', open: 'external', proxy: 'clients.domain.com/clientname/' }); }); Gulp and browsersync is running fine it seems, only the integration is tricky: I get timeouts or 404s with the auto generated snippet (apparently the relevant files are created dynamically on runtime, but I can't access or see them at the default paths) I'm probably missing something very obvious, can't be this hard, can it? - - - EDIT: Could this simply be a firewall issue? - entering the IP @ Browsersync's default port (3000) doesn't load anything - I used serverpilot to configure the machine so the firewall is set up with very few ports open, and obviously 3000/3001 is not one of them. I guess I'm off to find out if opening one of these ports is a good idea or not - - - EDIT 2: When running netstat -peanut I can see that the relevant ports are actually listening, so this is not a firewall issue after after all? tcp6 0 0 :::3002 :::* LISTEN 1000 184931 17882/gulp tcp6 0 0 :::3003 :::* LISTEN 1000 184942 17882/gulp
  15. @LostKobrakai thanks, this is actually what I am doing in the template right now $options_medimg = array( 'quality' => 60, 'upscaling' => false ); $options_smallimg = array( 'quality' => 48, 'upscaling' => false ); and then for the srcset: ... <img srcset=' {$image->width(1860, $options_largeimg)->url} 1440w, {$image->width(1600, $options_largeimg)->url} 1280w, {$image->width(800, $options_medimg)->url} 640w, {$image->width(480, $options_medimg)->url} 320w' sizes='(min-width: 1280px) 90vw, 100vw' src='{$image->width(320, $options_smallimg)->url}' alt='{$image->description}' /> ... Come to think of it, I suppose a simple text field where users enter an "override" quality could work. I would have to add a function to get rid of the previously generated assets for that gallery, but that should be rather easy.. Thanks for helping me think ,) I'll see that I post code in here once I solve this. cheers Phil
  • Create New...