Jump to content

horst

PW-Moderators
  • Posts

    4,088
  • Joined

  • Last visited

  • Days Won

    88

Everything posted by horst

  1. If I read it right, Blog want to get those, but why? Where is the code that do that? I don't know Blog (module / profile?). Suffixes are introduced since PW 2.4.15. Suffixes can be added to a variation name with the options: // if the original images name is basename.ext, the call for a width with a suffix "is" $options = array("suffix" => "is"); $image->width(200, $options); // results in this variation name: basename.200x0-is.ext So, the question is: Why, where or how does Blog trigger to create a variations name with suffix "is"? Pageimage::size builds the variationnames according to width, height, and the optional options cropping & suffix. Pointing me to the code would be of help. EDIT: Ah, now I saw that you hook into a process and "emulate" it by yourself: $this->input->get->width; Have a look to the original function and see if it defines / set a suffix named "is". If so, you need to add it to your emulation too. This will be fairly simple, if it is a static suffix. EDIT2: The line seems to be here: https://github.com/ryancramerdesign/ProcessWire/blob/dev/wire/modules/Process/ProcessPageEditImageSelect/ProcessPageEditImageSelect.module#L342
  2. Steve (@netcarver) has written a parent - children system with Diagnostics. This sort of parent module recognizes and lists installed children in the configscreen and should provide some basic functionality: Martijn's AdminCustomFiles. Anything more that is needed?
  3. To get the part of the url you can use parse-url
  4. Very well done site! But IMO there is room for a little aprovement regarding the popup slideshow. The overlay is to much transparent. The color of the blueimp-overlay-div is set to rgba with 0.7 and additionaly to this a opacity of 0.5 is aplied. As the result the page content is not coverd enough and interferes with the presentation of the projectimages. EDIT: What I mean is that the images are more outstanding in the second screen, on a darker, less transparent background / overlay:
  5. If one want to exclude all hidden pages one may use: if ($item->isHidden()) continue;
  6. I'm not sure if I understand you right. But if you cannot add the hook on template layer, you need to create a module: <?php class SizeToCloud extends WireData implements Module { static public function getModuleInfo() { return array( 'title' => 'Size To Cloud', 'summary' => __('This module handles relations between pageimages and S3 cloud', __FILE__), 'version' => '0.0.1', 'author' => '', 'href' => '', 'singular' => true, 'autoload' => true, // 'requires' => array('PHP>=5.3.8', 'ProcessWire>=2.5.0') ); } public function init() { $this->addHook('Pageimage::size2cloud', $this, 'size2cloud'); } public function size2cloud($event) { $image = $event->object; // the event object is a pageimage $width = $event->arguments(0); // first argument to pageimage::size is the width $height = $event->arguments(1); // yes, second is height $options = is_array($event->arguments(2)) ? $event->arguments(2) : array(); // and optional an options array can be passedd // now do the manipulation and catch the resulting variation object $imageVariation = $image->size($width, $height, $options); // get the filename for your cloud stuff $filename = $imageVariation->filename; // do your stuff here ... // // return the variation pageimage object // return $imageVariation; // what do you need to return here? } } This example code should be saved as a file named SizeToCloud.module. It should be cpoied under site/modules/SizeToCloud/SizeToCloud.module Then refresh your modules section find it under new and install it. For more on Modules refer to the docs and to the HelloWorld.module what is a super good example module with all commented.
  7. You may refer to all that is related to pageimages in the docs and the cheatsheet. You can everything derive from the pageimage object! For example go to the cheatsheet and select the advanced button, then filter for files (images are also instances of files), and voila, you will see that files have ->page. So you can use $image->page->id for the id, and everything else what belongs to page. Have a look at the cheatsheet for page. (use the advance button and / or click onto the properties and methods and then onto the more links)
  8. What do you want to do? You want add / copy / submit all final files of a resize manipulation (one of width, height, size) additionally to a cloud? This can be done by simply get the filename after a manipulation. For this you may add your own wrapper to the pageimage functions. There is also no need to change width or height to size, because width and height are only wrappers for size. Finally size is called for all pageimage manipulations. You can add a simple hook to pageimage like this: wire()->addHook("Pageimage::size2cloud", null, function($event) { $image = $event->object; // the event object is a pageimage $width = $event->arguments(0); // first argument to pageimage::size is the width $height = $event->arguments(1); // yes, second is height $options = is_array($event->arguments(2)) ? $event->arguments(2) : array(); // and optional an options array can be passedd // now do the manipulation and catch the resulting variation object $imageVariation = $image->size($width, $height, $options); // get the filename for your cloud stuff $filename = $imageVariation->filename; // do your stuff here ... // // return the variation pageimage object // return $imageVariation; // what do you need to return here? }); // in your templates now you call the images like $image->size2cloud( 200, 0); // or $image->size2cloud( 200, 200, array("crop"=>false, "quality"=>70, "sharpening"=>medium)); // or $image->size2cloud( 0, 200); This can be set into a template file, e.g. if you have something like a inifile that is included into all template files. Or, if do not use this technique, you build a module from the function.
  9. The line is an example, I wanted to suggest that you use one of them, that one that makes most sense. I said use this or that. If you only use PHP functions that are available with e.g. PHP 5.3, you simply can require PW>=2.4, because PW 2.4 itself requires PHP 5.3.8 or greater. But if you have a module that also would run with PW 2.2 or 2.3 regarding the PW core, but needs PHP version >= 5.4, then you must require PHP >= 5.4. I always would note the PW version, and only if the needed PHP is higher than the minimum required for PW I would note this additionally. I think the only situation not to note the PW version would be if your module run on all versions from 2.2 - 2.5. EDIT: Ah, now I understand. I have downloaded your new version: I don't know which versions your module need, sorry for confusion. It was only an example that should provide the typo, not the correct values / versions. I think you need PHP 5.3.0 because of the namespaces, but which version of PW it works with I don't know. Maybe >= 2.3 or >= 2.2 ? A hook to page::render is not one of the recently added functions.
  10. Hhm, it wasn't clear to me that you have encountered differences between Pageimages derived from Pageimage or derived from PiM. (or I may have overlooked it in all that examples) I think it would have avoided some confusion if you just have asked / told that the objects behave different, without (partly wrong) code and lots of error messages. You are also speaking about filenames generated with .0x0 in its name.?! Pageimage::size generates the filenames before any manipulatiuon through ImageSizer and only according the passed values for width and height. So, at that point you may check what values you are passing to the functions. ------ But lets focus on that objects thing: I will try to replicate and compare that. Just to clarify a few things: You have checked that after your PiM call a Pageimage Object is returned? Have you tried it with a PiM that does other manipulations, maybe just pimLoad()->pimSave(). Does it behave the same or is it different? Pim generates the PageimageObjects this way: https://github.com/horst-n/PageImageManipulator/blob/master/ImageManipulator.class.php#L751 It looks the same like Pageimage::size does it: https://github.com/ryancramerdesign/ProcessWire/blob/dev/wire/core/Pageimage.php#L316 So, we need to compare the objects, first try with simple objects that only should differ in the name: $size = $image->size($image->width, $image->height); $pim = $image->pimLoad('test')->pimSave(); And then with a manipulated one from your example. ------ Ah, ok! Sorry for remember me wrong!
  11. Oh, no haven't done those things. Maybe there are already modules out that do similar things where one can study the code?
  12. maybe a part could be done by restricting children - parent relation via family settings? Template for parent that only allow a single Template for children. That way, when adding a child, it has the right Template and the right position. Only thing left is the population of your field.
  13. Hi Philipp, ähm, may I say that this sounds confusing? You only need to double check here if it returns a valid pageimage and has created the derivative file. If both is yes, PiM has done it work successful. If you further do not call PiM anymore, it has nothing to do with PiM! - Ready! ------------------------------- Looking at your code: $out .= "<img src='{$image->width(260,0,$o)->url}' What is width 260, 0, $o ? You have done the same things wrong like in earlier posts. Passing a zero as second option to width, what should be an array with options! Ryan has changed pageimage::size to silently fail with this instead of crashing the process. This was a wish by yourself! Another thing is that you has run into timeouts with imagesizer in the past. I have posted a solution to you and maybe over 10 times more here in the forums: include a set_time_limit() in every loop that calls imagesizer. ( foreach($sets as $s) ) ! There are two options for the set_time_limit() now: please add it into your loops or only use PW >= 2.5.10 in the future, because PW since 2.5.10 has an own set_time_limit() call in ImageSizer!
  14. //we only get one random coupon page (we use 'get' rather than 'find') $couponimage = $pages->get("template=service-pages, images.tags=coupon, sort=random")->images->getTag('coupon'); @Kongondo: Your code together with the pages selector from Dave should be a solid solution. - But haven't tested. @Dave: Welcome.
  15. Thanks for sharing! I will test it later this week when find some time. I think this is helpful to me while developing on the Markup of a page. ------ BTW: I would recomment to add to your getModuleInfo() a "requires" key like: 'requires' => array('ProcessWire>=2.4.0', 'PHP>=5.3.8'), You use Namespaces with your module and therefore the minimum needed PHP Version should be noted in the required value(s), or the minimum PW version. At the moment it is not mandatory to note this, but it is helpful anyway.
  16. This CryptoPHP is really bad stuff. Especially on W*rdpr*ss it installes an additional AdminAccount too. This way the attackers may have server control after the desinfection of the malware code itself. CryptoPHP is PHP-code within a file that should be a PNG-image. There is a python detection script on GitHub available: https://github.com/fox-it/cryptophp/tree/master/scripts
  17. Maybe when unzipping it got lost. In the release it is present. Just open your downloaded archive and copy over all files of wire/ over your actual files again. But do not copy any files under site/ again. This will brake your installation. EDIT: OK: @Kongondo: 1:1 EDIT2: Uups! @Matt: Welcome!
  18. There seems to be a file missing, maybe? Can you please have a look for this file: C:\xampp\htdocs\processwire\wire\modules\Inputfield\InputfieldSelectMultiple.module Does it exist?
  19. <now you are already half way social engineered>Hah!</now you are already half way social engineered> read more ... (blog.fox-it.com) OMG! When it comes to the combination of these two human characteristics the world is uncertain: greed and stupidity.
  20. hint! or in short: 22 or "0.2.2"
  21. horst

    PrettyPhoto

    It has nothing to do with PW I believe. PW only gives you the urls where the images resides $image->url. Cannot imagine how that could be get wrong. I have found the gallery what @KG60 seems to mean. For me it is looking like wrong calculations for div.pp_overlay and (maybe as a result of that) a wrong calculation for div.pp_pic_holder. And this is not a thing related to FF only. I see it with all my browsers the same (Win7 FF, IE11, IE10) Some questions came to my mind when seeing this: Why is pp_overlay defined by class and not by ID. I think it has to be a single unique div. Why is it calculated to cover the document dimensions and not the viewport dimensions. The first one may be not of interest, but the second one is the point that is wrong here I bet. Or if this is right too, than at least the position calculations for the div.pp_pic_holder are wrong (don't know / remeber if it is derived from overlay or not). It definately generates the right with and height, according to the viewport, but the wrong position. Also if one adjust the srolling a bit, it corrects to the correct position. Also the overlay goes way way beyond the footer of your document, and when it appears the other divs get scrollbars. --- FF win7 wrong position! ---- IE 11 In IE it also doesn't correct the position like in FF, and the other content divs only get vertical scrollbars.
  22. Yes, I know and I have used it initially that way. And you also can do it now: when passing width and height instead of square, the other possible options are ignored and the result should be similar to what you have got with the gist code, but maybe a bit larger. (20%) I thought it would be easier and less confusion for average users to just have a switch for on/off and if they define a square of 120 that they get back the largest possible image with 120px. If you also like / need the comp param dynamically to define, it can be easily added as a 'silent' option.
  23. New addition to contain: weighten! If you want to put some images of different aspect ratio onto a webpage and you want that they are displayed more equal visual weightened, you can use this method and options now: . * contain with option weighten $image->contain('square=90, weighten=on'); . . There is also the possibility to prioritize portrait or landscape oriented images: . $image->contain('square=90, weighten=x1'); // landscapes are a bit larger than portraits $image->contain('square=90, weighten=x2'); // landscapes are a bit more larger than portraits $image->contain('square=90, weighten=y1'); // portraits are a bit larger than landscapes $image->contain('square=90, weighten=y2'); // portraits are a bit more larger than landscapes . . Have a look to this output here: . . . . . PS: @Martijn: I have taken your code for the calculations and set the percent value hard coded to 38. This way we only need to turn weighten on or off and have not to deal with values here. The only thing I have added to the calculation is an adjustment to fit better with the largest dimension into the initial bounding box dimensions. (Github)
  24. You are not talking about the options tab where you can choose between Thumbnails and FullsizeImages, ?? I think it is not of any help for pwired to wait for 160 fullsize images get loaded instead of 160 thumbnails.
  25. @Soma: How can it be done?
×
×
  • Create New...