Jump to content

horst

PW-Moderators
  • Posts

    4,077
  • Joined

  • Last visited

  • Days Won

    87

Everything posted by horst

  1. Hi, welcome to the forums. I'm not sure what you have done with "git checkout -b devns" and afterwards with "git checkout -b dev", but dev and devns are two seaparate branches of Processwire. dev is the 2.7.3+ dev branch, and devns is the 3.0.15+ branch. I'm not comfortable with git, but why do you checkout two times?
  2. what? please try: foreach(array(-5, -1, 0, 1, 5) as $id) { var_dump((bool)$id); }
  3. What I exactly meant is: sanitizing with intUnsigned() and add some own logic (template or equal).
  4. Soma is right here. It isn't enough to sanitize to an integer, you also need to add some own logic, that reflects what you are expecting.
  5. $sanitizer->int() or php natives (int) or intval() will do. Looking up in tools like API-gen, maintained (with everytime the newest codebase) by Kongondo, is much more faster than asking (such simply code/method related things) in the forums. I highly suggest to use this. It will save you a lot of time, that you otherwise have to wait until someone other answers your questions. --- EDIT: Oh damn, - @arjen beats me, while I made the screenshot!
  6. Hi @wsjmdavies, welcome to the forums. This seems to be not exactly determined what you've explained. But no problem, we can go together step by step to inspect what happens. Regarding uploaded (original) images and image variations: If you upload new images to an images field, the original uploaded files never get altered, with one exception. (I come to this later *) So, the original (uploaded) file regularly is unaltered, means has the exact filesize and contents as your local copy. Only the filename will get altered to match the criterias for asset filenames in PW. (all lowercase, 0-9, a-z, _-, no dots, etc) Image variations derives from the original uploaded source and are altered according to your request. (different dimensiones, optionally cropped, etc). A few part is reflected in a suffix that is appended to all image variations filename. (basename.jpg becomes basename.0x100.jpg or that like) --- How have you determined that the original file gots altered? What are your settings in the images field? Do you have any setting there in the fields for max-width or max-height? (* this would be the only exception where uploaded files can get altered!) You have uploaded an image that contains compressed image (bitmap) data. Photoshop is able to apply a (hopefully) lossless compression to the bitmap data before storing it into the image file. ImageRenderingEngines in webenvironments often have not included equal compression algorithm. SO they uncompress the bitmap data, alters it, and stores it uncompressed, or with much lower compression rate into a new file. (What explains why a new (variation) file has higher filesize) BTW: using compressed images as original sources for variations is a bad idea. It is not much relevant with PNGs, but highly with JPEGs: mostly you will not serve the originals, (or you shouldn't do), but generate and serve variations. to generate one, you need to open (and uncompress compressed bitmap data) of the original image (more CPU usage each time) with JPEGs, what do not have lossless compression, you multiply building of compression artefacts with each saving / compression of bitmap data Best practice is: upload (original) images with 100% quality, and / or without compression. Do not serve those originals directly! If you need to serve images with the full dimensions, create a variation with 100% width/height, but lesser quality (e.g. 80% - 90%) $original = $page->images->first(); $options = array('quality' => 80, 'forceNew' => true); // forceNew is recommended for testing purposes only!! $variation = $original->width($original->width, $options); // create an identical variation with lesser quality and filesize
  7. Or do you mean Repeater? Here you can group (via Template) fields together and use them multiple times in one page.
  8. PageimageSizerImagick isn't compatible with PW greater than 2.5.11 ! It doesn't support the then (2.5.11) introduced naming scheme for image variations in PW. It was more like a case study. But maybe you can switch to PW 3 devns, there you will find support for Imagick PHP-Extension, ImageMagick-CLI and NETPBM-CLI supported. If you can do, you need to read upon how to "convert" CroppableImage to work with PW 3. KentBrockman and noodles have posted this into its support thread: https://processwire.com/talk/topic/8709-croppableimage/page-7#entry113941
  9. horst

    MarkupSrcSet

    In addition to LostKobrakai, the function schema looks like: public function mySrcsetFunction($event) { $image = $event->object; $markup = "<img src='{$lqip}' data-src='{$image->url}' {$aspectratio} class='lazyload lazypreload' alt='{$image->description}' />"; $event->return = $markup; }
  10. Not sure if I can understand what you have done, nor how you have done it, nor what you are after. ?? Looking into my glass ball, I would say: First, inspect the raw value of $input->post->note_page_id <?php echo "<pre>"; my_var_dump($input->post->note_page_id); die(); If you expect an numeric ID and it does contain more than that, you should change your html form field accordingly. And if you get a numeric value, you can sanitize with int, not text. Or you simply use PHPs typecasting via (int) or intval(). $note_page_id = (int)$input->post->note_page_id;
  11. and if you want to retrieve an image by name $article->product_image->get("name=picture.jpg")->url
  12. A pro would be, to have it into the TracyDebugger toolbox makes it independant from your own browsers and its extensions. Useful in the more rare cases, where you are using a foreign PC. So, it should be in, but disabled by default.
  13. Have you tried the PagePathHistory module? It handles the redirections automagically under the hood whenever you change a pathname. (If I remember right, it is a core module(?) by default disabled)
  14. Do you use any sort of markup caching? TemplateCache, ProCache?
  15. I think you can use what you best like. If you are comfortable with repeaters, you can use this. If you are more comfortable with others, use others. But I cannot understand why you want to do it from scratch, if your questions already start at this early point? Is this a free project, that you want build just for learning, or is this a productional project for a client?
  16. Is the template name of your single blog posts really "home-single"? If not, you also have to change "home-single" in your pages->find selector to the real name of its template (in @diogos code example). Ah, - and welcome to the forums @Mijo.
  17. Hi @Gazley, you are speaking of the new core (PW 3) ImageSizerEngineIMagick.module? (Better do not use the old IMagick Sizer module, or, if so, do you stuck with PW 2.7 ?) But to your question: The hirarchy of options is this way, lowest to highest: (higher ones overwrite lower ones) module default (is only there if all others are missing) global setting in wire/config.php (is the distribution default) global setting in site/config.php (can be set to overwrite the distribution default per site) setting in array options, passed to pageimage (overwrites all others) with methods width, height, size If the module has a default of 80, the wire/config.php has 90, the result is 90. If you pass an option with 75 to size(), the resulting quality is 75. Pia is only a wrapper around pageimage, so any option passed to Pia (pageimage), overwrite all other (hirarchically previous) options.
  18. Also, every time if something weird is going on, having a look into the AdminDebugTools Hook-Section is useful (I believe you can call it from within TracyDebug too). Here you may spot if multiple / different modules hook into the same methods, or into "nearly" the same methods, what always has potential to interfere.
  19. Some of you may have read about it: there are a new core images field in the works for the PW 3 branch. I want to wait until this is released and then update the Croppableimages to sit upon that. I think it will become a new version for PW 3+ only, as there is the current version available for the PW 2 branch. Besides some PW 3 namespace issues there should be implemented changes to work with the new images field in that way, that it only enhances this with the cropbuttons but leave the other UI as is (reuse it). I'm not very good with this UI stuff, so, if I will not be able to do this myself, I will ask here for help on that. If this will be the case, I will provide an intermediate version that works with the PW3 and new image field first. Everyone who can't wait until then should use the slightly hacky upgrade procedure provided by @KentBrockmann and @noodles, two posts above this one.
  20. Hhm, for me it is working: D:/ProcessWire/PW-DEV/pw30/htdocs/site/assets/files/1/nikon2208.jpg D:/ProcessWire/PW-DEV/pw30/htdocs/site/assets/files/1/nikon2208.-pim2-pxtd.jpg I used PW 3.0.10 You may look at other modules that work with files and images. Maybe you can create a siteprofile with the exporter or are you able to temporarily disable site-modules in the original site? So, your code is working, the Pim2 is working, but not in your setup. If possible, I would disable all (autoload and file/image-related) modules, and try if it works then. If yes, enable one module after the other, and check if it is working or if it breaks again. Or the other way round: disable one module, check if it changes, if not disable the next one, ..., ... YOu may also first have a look to the Hooks-Section of the Debug Mode Tools in the admin footer to get an overview which modules hook into what, maybe this way you can spot primarily candidates very fast. It all depends on your setup I believe.
  21. Oh, sorry! --- --- --- Is $pic->image an imagefield set to hold multiple images or only one image? Please, can you, for debug purposes, output the filename of the variation, instead of adding it to the imagefield? $options = array('outputFormat'=>'jpg','quality'=>70); $originalImage = $pic->image->first(); $pixelateVersion = $originalImage->pim2Load('pxtd',true)->setOptions($options)->width(700)->pixelate(30)->pimSave(); echo "<p>{$originalImage->filename}<br />{$pixelateVersion->filename}</p>";
  22. There are no prefixes supported in PW 3. (but suffixes) I assume, you use Pim1? If so, you need to switch to Pim2. Have a read here: https://processwire.com/talk/topic/9982-page-image-manipulator-2/ If this is not the case, please post again.
  23. How do the both templates differ? (besides the names) I haven't used it myself and don't know, but: is there anything that need to be checked in templates to use utf-8 names?
  24. You mean, if my DBs are different, I cannot use it for syncing without caution? But is it safe if I want to replicate, for example, my local DB to a public site? Or would this only be safe, if I insert the sql dump after I have completly emptied the target DB? That's (something) what you mean, right?
×
×
  • Create New...