Jump to content

horst

PW-Moderators
  • Posts

    4,077
  • Joined

  • Last visited

  • Days Won

    87

Everything posted by horst

  1. You are local on Windows? Windows filesystem isn't case sensitive. Others are. That's why it works on windows, and that's why windows is not the best dev-platform. So, I'm working on windows too, but have the advantage that I'm working with win-computers since back to times of DOS. (That was before Windows 3.1 ) Some of the restrictions from that times I'm using until today, regardless of current working platform: only lowercase filenames, if there is a 1% change that a file may uploaded to webspace, no spaces in filenames, - never! (Is of interest until today, if you use CLI progs somehow.) ... but I'm very happy that the filename length is more than 8.3 today
  2. Huh! This is interesting! I need to explain a bit about the naming conventions of image filenames in PW, I think. /site/assets/files/{page-id}/basename.jpg /site/assets/files/{page-id}/basename.0x260.jpg /site/assets/files/{page-id}/basename.-tag1-tag2.jpg /site/assets/files/{page-id}/basename.-tag1-tag2.200x300.jpg /site/assets/files/{page-id}/basename.800x800.-tag5-tag3.jpg /site/assets/files/{page-id}/basename.800x800.-tag5-tag3.200x300.jpg Beginning after the basename, with the first dot, every dot indicates an imagevariation that also exists as a file. (only the last dot leads to the file-extension) Every previous part in the chain is the [source | parent | original] of the actual part. The tags chain, implemented into PW around 2.5 and made to become very robust and foolproofed by Ryan around 2.6, was meant to be used as lowercase tags, concatenated by - chars. This very restrictive usage is due the valid filename characters (lowercase), and the preserverd dot, and to prevent concatenating multiple same tagnames. (this is cleaned up to become unique in the filenames). But this is not very userfriendly in cases like the CropNames, and the users are not aware of this restrictions why it is / would be important to follow them. Thats why I have to handle the cropnames less restrictive. Thats also the reason why the implemented tag system in PWs imagenames cannot be used like intended. All the cool methods to get the variations of a parentimage (getVariations(), isVariation()) will fail in many cases when using images with an (invalid) tagname / cropname! That's why I was happy to find another bulletproof solution for getting rid of the srcset variations. (Detecting the children of a crop-parent) @PWaddict The way you uses it isn't an intended one. You create different INTERMEDIATE crops. The intended way is to create 1 INTERMEDIATE crop image, that serves as parent for the derived variations. But this intermediate functionality also is obsolete and will become deprecated in the next version, as it isn't much useful but leads to code bloat and confusion. Also it sin't possible to detect derivatives of that sort. Imagine a setup with 3 cropnames: test & test-portrait & test-landscape. As we have already read above, people do this a lot, using invalid cropnames / tagnames, with - chars or Camelcase, etc. Now go select and create a new crop of the "test" cropname. It will errorinously also delete all variations of test-portrait and test-landscape. Also image variations that may have the cropname on another place in the filename will get deleted too. The only way to detect variations is to keep the parent-children relation. (Blood is thicker then water, ) Maybe you can use it this way: $thumb_master = $photo->photos_main_photo->getCrop("thumbnail"); $thumb_medium = $thumb_master->width(660); $thumb_small = $thumb_master->width(480); $thumb_x_small = $thumb_master->width(360); This is the intended way that brings you back into sync with the system.
  3. @flydev: Really I'm not feeling in the right position to give suggestions here. I appreciate all the work and recherche you do here, so you should decide what is lesser work or fits better for you, for what ever reason. - If, at the end, a solution is available that let people login with their twitter account, it would be really great and is much more than there is atm.
  4. @tpr: I added the tiny thumbs. One little downside is, when returning back from the Modal, after creating the new Cropimage, they are not updated automatically. Only after page refresh.
  5. The originals timestamp gets updated because the new settings for the croprectangle (x/ypos & width/height), and sharpening & quality values get stored into dedicated IPTC-fields. (ATM, for jpeg only, what also is the reason for thinking about other solutions) Tiny previews is a nice idea. If you don't mind I will take your suggestion and bring it into the module. Will fix that asap. Many thanks for checking and suggestions! <3
  6. @mauricemoss, @ukyo, @dreerr, @tpr I have uploaded an update to the github repo that fixed the PHP notices and added removal of CropImage children after creating a new CropImage.
  7. Embedded into AOS is pretty good! Wondering why not use this hook: https://github.com/horst-n/PageTreeAddNewChildsReverse/blob/master/PageTreeAddNewChildsReverse.module#L48
  8. I do not update all sites to 3.x or 2.8.x. I have sites from 2.4, 2.5, 2.6, 2.7, and some different 3.0.x. Only one of version 2.8! (never touch a running system)
  9. I don't know. What comes to my mind, and thats why I posted this to @PWaddict, is, that with my module simply the next free number (counted down!) is put onto the new page. No need to resort all other siblings! With a huge amount of sibling pages, the new sort function may slow down the process. But I haven't tested it.
  10. unpublishing doesn't help. You need to start with an empty parent! once I moved all children to a temporary parent, installed and configured the module, and then moved the children back. But please, do a BACKUP of your DB before!
  11. horst

    MarkupSrcSet

    $page->featured_image doesn't return a valid object! (It returns a "non-object") You need to check that it returns a valid image object. Check if you set the image field to return a single image or an array of images. Also you always need a fallback for cases where no image is uploaded to a field!
  12. Hi @tpr, I will look into this and add a solution that will work properly together with markup-srcset, (and other cases). Thanks for the clarification.
  13. Many thanks @flydev , for digging deeper! I'm currently out of resources to code something like this. Was just searching for an already available solution to login via twitter. Registration should be done via PW only, where the PW username is set to the twitter username. (Frontend)-Login then should be done via Twitter only. So, if we would be able to retrieve the email address too, it would be more than I currently need.
  14. @flydev wondering that Twitter isn't supported too? Couldn't find it here: http://oauth2-client.thephpleague.com/providers/thirdparty/
  15. So, this isn't my favourite Music, but it is Music. At archiche.org you can download / listen to 25k+ 78rpm recordings like this one: https://archive.org/details/78_bugle-call-rag_metronome-all-star-band-pettis-meyers-schoebel-t.-mondello-b.-carter_gbia0011087a/Bugle+Call+Rag+-+Metronome+All+Star+Band.flac
  16. Interesting would be how you have initialized $mail?
  17. I would use the hook that is called on adding the image to the images field. This is called everytime you add a new image, regardless if you do it via API or via Inputfield. An up to date code example for this hook is here: In this example you can check for a $p->template->name to match as condition to run different code parts, etc. To resize the original image itself, you may want to invoke the imagesizer manually. ---------- Instead of the hook, (for your case above), you only may use the manually invoked ImageSizer for each uploaded file *before* you add it to the image field: // set the max dimensions $targetWidth = 800; $targetHeight = 600; foreach($upload->execute() as $file) { // first get the filename of the *original image* (in case when hooking into file add !!) $filenameOrig = $file; // set options to not upscale, and set quality to 100%, if this image is a source for variations!! $options = array('upscaling' => false, 'quality' => 100, 'sharpening' => 'soft'); // call the imagesizer $imageSizer = new ImageSizer($filenameOrig, $options); $success = $imageSizer->resize($targetWidth, $targetHeight); // resize to max dimensions if($success) $lesson->video_image->add($filenameOrig); } ---------- If you first need to inspect an image, (for conditional processing), you may use the ImageInspector : $imageInspector = new ImageInspector(); foreach($imageFiles as $filename) { $result = $imageInspector->inspect($filename); // to check if we have a valid result, it must be an array if(!is_array($result)) continue; // $result['info'] has all relevant data, like width, height, imageType, mime, orientation, rotate, flip, channels, bits, ... $width = $result['info']['width']; $height = $result['info']['height']; // ... }
  18. You should try to uninstall WireMailSMTP and try sending with native WireMail. This should work, as it uses the PHP mail() function. If WireMail works, and WireMailSMTP don't, it might be firewall restricted by your hosters settings. Native PHP mail function is controlled and allowed by your hoster, other (foreign) connections (other IPs or only Ports) maybe blocked by firewall settings of your hoster. (?)
  19. @ryan thanks a lot! I had a little use case where I couldn't resist to use the new feature. It was only for pages with text fieldtypes. I used two little bootstrap scripts to export & import some pages. export.php import.php
  20. Hi @Dennis Spohr, most things can be done with hooks. Hooks are class methods that have 3 preceding underscores, so you may find them in the php and module files in the wire folder. (Using a "search-in-files" function of your Editor / IDE: "function ___"). Or go to Captain-Hook. Unfortunately or Fortunately, the part with sending emails on exceptions / errors seems to be completly different. It uses the native PHP register_shutdown_function, done in WireShutdown.php and therefore is not hookable through the PW system. But the PHP docs say that it is possible to register more than one shutdown-function, and that all functions get called on shutdown. So you can register your own one. If you want to have the ability to optionally bypass processwires shutdown function, you must register yours before PWs one. (I don't know how, but would try it in site/config.php first). Than, in cases where you don't want PWs function get called, you can exit yours with exit();. Otherwise other registered functions get called and executed too. Have a read in the WireShutdown::shutdown() function. There you see how to check if there were an error, how to get it and how to inspect it, etc. ----- Also there is the site/finished.php file, that gets executed at the end. But this one I haven't used til now and don't know if it get called on exceptions too. ----- If you test and further questions apear, come back and ask.
  21. @jploch checking the image type: $image = $page->images->first(); $imageSizer = new ImageSizer($image->filename); $imageInfo = $imageSizer->getImageInfo(false); This will return strings like: jpg gif gif-trans gif-anim gif-trans-anim png24 png24-trans png24-alpha png8 png8-trans In your case, when gif-trans-anim is detected, you want to switch to css-workaround.
  22. horst

    MarkupSrcSet

    I moved some posts not related to MarkupSrcSet to the ImageAnimatedGif thread.
  23. @jploch The crux is with the transparency of the background. The original image is recognized as a transparent, animated GIF. But the stored transparency color index validates to 0,0,0 (black !) I have opened your image in photoshop and added 1 layer filled with white to the base of the other 60 layers. The animated resulting GIF is same size as yours with transparency but works with the anim module: To sum up: the anim gif module doesn't work in any case with this sort of images. The culprit is the transparency background. If you are able to add a filled background layer to those images, it will work good with resizing. (test the image above) If you also need the transparent background, you cannot use any sort of variation creation. Workaround could be to determine in template file if it is a GIF (or only if it is an animated GIF) and then use markup with a special css class for displaying those in different sizes, according to media query max-width, for example.
  24. @jploch I have tested this and created a new Rendering Engine, but for me, every created variation has the same (wrong) result as your example. It is something in that image that doesn't work right with the lib. I think it is a false transparency for every slide in the animation. Are there other images that behave the same? In your "working example" that result in correct variation, I belive it is the original image or simply copy of it. You use ->width(300) and the original is 300px. For me, every downscaled variation doesn't work correct.
  25. maybe you can store it in $session and check this before sending the emails? if(true !== $session->emailsAlreadySent) { // or: wire('session')->emailsAlreadySent // code to sent emails here ... $session->emailsAlreadySent = true; }
×
×
  • Create New...