Jump to content

Robin S

Members
  • Posts

    4,958
  • Joined

  • Days Won

    323

Everything posted by Robin S

  1. Not really sure what you're getting at here. Do you mean you could do this in Photoshop? Because you could, but Photoshop doesn't run on your server. This is for processing images on a website, maintainable by your client. You're going to download, open Photoshop, filter and reupload each time your client changes an image? That's definitely not more efficient.
  2. Not a module, just a little function for applying effects to images if you have the Imagick PHP extension installed. This started out as a need to blur an image and then I expanded it to accept more of the Imagick methods. Not all Imagick methods are supported. The function takes the URL to a source image, the name of an Imagick method and an array of arguments for that method, and returns the URL to the processed image. The processed image is saved to same directory as the source image, with the method name and arguments appended to the name of the source image. Images are cached in that the function checks if an image with that name/method/arguments exists already to save recreating it on every page load. function imagickal($imagePath, $method, array $arguments) { $path_parts = pathinfo($imagePath); $dirname = $path_parts['dirname'] . '/'; $filename = $path_parts['filename']; $mod = $method . '-' . implode($arguments, '-'); $mod = wire('sanitizer')->filename($mod, true); $savename = $dirname . $filename . '_' . $mod . '.jpg'; if (!file_exists($_SERVER['DOCUMENT_ROOT'] . $savename)) { $image = new Imagick($_SERVER['DOCUMENT_ROOT'] . $imagePath); call_user_func_array([$image, $method], $arguments); $image->writeImage($_SERVER['DOCUMENT_ROOT'] . $savename); } return $savename; } I'm a PHP novice so happy to receive suggestions of how this could be improved. Imagick reference: http://php.net/manual/en/class.imagick.php Examples of some effects possibilities...
  3. I've just watched the demo video for the amazing Visual Page Selector module that kongondo is working on and it's got me thinking about the one-image-per-page approach to managing images. I haven't had a project that needed to reuse images on a large scale but I can see how it would be a good approach for managing a media library. My question: when it comes to adding new images in the one-image-per-page approach, I understand how it's easy to do this via the API but how do you make it easy for site editors to add multiple images at once and add descriptions and tags to those images? Has anyone devised a module that that allows images to be added and described from within the PW admin? Or would it be simpler to create a form on the frontend (with restricted access) to handle image uploads/descriptions/tags?
  4. Ahh, it's a Firefox-specific issue. Thanks for the info. There are probably ways to get the desired behaviour in Firefox (e.g. give the password and confirm fields similar properties so they both get autofilled, or load the Set Password field with AJAX only if it is opened), but maybe it's not considered worthwhile to make such changes just for the quirks of one browser.
  5. I think this has been requested before, but I can't find the thread I read it in. The user profile page can contain the selection for admin theme if more than one is installed, and possibly other fields too I believe. It would be good if these fields could be changed without having having to enter the user password. Also, if you forget to type in the password when attempting to change another field on this page and get the "Passwords do not match" error the change you were trying to make is not remembered and you have to make the change again.
  6. Github issue is here for those interested, along with a suggestion for an alternative approach to making the input form pretty.
  7. Setting the CKEditor field to inline mode does fix the bug. I think I have traced the bug back to these lines of JS code, which attempts to match the height of adjacent columns with every change (e.g. keypress) to the CKEditor field. Will open a Github issue for this.
  8. Just tried the current stable and can't replicate the bug.
  9. I'm experiencing a weird bug with CKEditor that seems to occur when a neighbouring field in the same row is taller than the CKEditor field. Firefox: when typing the cursor jumps to the start of the CKEditor text area with every keypress. IE: when typing the text appears below the CKEditor window. Chrome: the bug does not occur. The screenshots below show the result of typing the second line "How now brown cow?"... All browsers, neighbouring field shorter than CKEditor field (no bug) Firefox, neighbouring field taller than CKEditor field IE v11, neighbouring field taller than CKEditor field If someone can confirm they get the same bug I'll file an issue on Github. Thanks.
  10. Thanks Soma, I understand better now.
  11. Thanks adrian, that works fine, although it does start to get a bit long-winded depending on how many pages you want to match. Any idea why the pipe syntax can't be used like with ID and other fields? In my case I'm selecting pages to appear in the main navigation. I was using name but then an editor created a news item called "News"... So was aiming for something more unique than name but more readable than ID. The combination of name and parent is a great suggestion.
  12. The API docs have an example for OR selectors, to match any of a group of page IDs. id=123|124|125 What is the correct syntax for doing something similar but using page paths? I tried... $pages->find("path=/news/|/about/") ...but no success.
  13. Is it possible to use the "selector" option to choose menu items based on parent? I tried... "selector" => "parent=1020" ...and... "selector" => "parent=/my-page/" ...but neither of these worked. I know I can do this by setting a PageArray as the root object but I'm trying to understand why I can't do this with the selector option.
  14. I've noticed that the search box in the header of the ProcessWire website and forums doesn't work very well. For instance, how is that a search in the Modules section for "admin custom files" doesn't deliver the page for the module with this exact name as the first result, or even anywhere on page 1? It doesn't appear in the results until page 4 of 5. The forum search isn't great either, and maybe that's down to IP.Board. But what about the rest of the official PW site? Is that running on ProcessWire? It seems like a bit of a bad advertisement for PW if the official site is running it but the search doesn't work well. I find myself relying on the Google Custom Search to find things. Are there plans to improve the built-in search on the ProcessWire website?
  15. I think I understand what this module does but I'm having trouble grasping the situations in which it would be useful based on the examples you've given. Is it just a convenience thing, so the editor doesn't have to look elsewhere for some information that might affect the content they decide to add to the page?
  16. Don't think this made it into the default admin theme, so +1 for this.
  17. I'm a bit late to this thread, but I just thought I'd add that there is a config option for opening "View" links in a new window from Page Edit: viewNew = 1 I don't think there is a config option for the view links in the page list though - would be great if there was.
  18. This solved issue one for me: CKEDITOR.on("instanceReady", function(event){ InputfieldColumnWidths(); });
  19. The "setHeight" function sets the height of a filler div to equalise the height of inputfield columns in the admin, so everything looks neat and tidy. I like this and the overall attention to detail in the admin UI, but I've notices a couple of issues with this method of equalising columns. 1. The function fires on document ready but this doesn't allow time for CKEditor fields to load and these can change the height of a column by quite a bit when loaded. Perhaps setHeight should fire on window load instead of document ready? (Edit: I tried this and it doesn't solve the issue. Probably needs to fire on a callback from CKEditor). Or perhaps a CSS-only solution could replace this Javascript approach, utilising display:table-cell or flexbox? 2. The function fires even when the viewport is narrow enough that the layout has switched to single column. In this case the heights don't need to be equalised because the columns are stacked on top of each other, and the extra filler space looks weird. This issue affects the Form Builder module too, where the filler div can cause the form to expand beyond the height of its iframe. I cludged together a CSS fix for this like so... @media only screen and (max-width:767px) { .maxColHeightSpacer {display:none !important;} } ...but it might be better to use something like enquire.js to make sure the function only fires above a certain breakpoint. Edit: just discovered another small issue... 3. The function doesn't fire after images and files are added to a field, which of course changes the height of the field. Is there an AJAX callback for image/file uploads I can use to retrigger the function? Any thoughts?
  20. @Christophe I think in your second menu you want $rootPage = $page->rootParent;
  21. When rendering two navs on the same page it seems that the first interferes with the second. If my first nav is... $menu = $modules->get("MarkupSimpleNavigation"); $items = $pages->find("parent=news"); echo $menu->render(null, null, $items); ...and then my second nav is... echo $menu->render(); ...then that second nav only shows children of news even though no PageArray is passed in to the render method. Even if my second nav is... $second_menu = $modules->get("MarkupSimpleNavigation"); echo $second_menu->render(); ...it still seems to be limited by the PageArray of the first nav. Can someone explain where I'm going wrong here? Thanks.
  22. Okay, I understand. My PHP skills are not fantastic but I expect that I could use your module as a guide to creating my own textformatter. If I can get a class on images in the RTE then I'll see if I can work out a textformatter that generates image markup based on class. That's true, but it seems like a drastic step to throw away the original image resolution to achieve a particular size for frontend use. If a larger size is ever needed you no longer have the original image.
  23. The ProcessWire image plugin used in CKEditor has some great features that give editors a lot of options when inserting images into RTE fields. Giving site editors this much control is good if those editors are technically literate and make wise layout decisions. In my experience this is often not the case. Rather than let editors choose to center an image here, insert a 3000px image there, upscale an image here, link to an original there, etc, I'd rather be able to set up some predefined options and then let editors choose from them when inserting an image. And I'd like to have those options be reflected in the appearance of images inside the RTE window after the image has been inserted - so a "full-width" image appears as such, "logo" image is small and floats right, etc. In other systems I've achieved this through the use of classes: when inserting an image editors choose from a dropdown of classes. These classes can then be used to control the appearance of images in the RTE window (via custom CSS styles for the RTE) and used to determine the final frontend result via PHP processing or jQuery selectors. A couple of ways the Page Edit Image module could be enhanced... Simple Allow custom classes to be added to images when they are inserted, just like the Page Edit Link module does.This would allow custom styles to be applied in the RTE window, and site developers could write their own Textformatter modules to apply different markup based on class or do things client-side with jQuery. Even better! Provide an interface in the module configuration that allows image "profiles" to be defined. Useful options would be:resizing cropping create link to enlargement (with resizing options for enlargement - the current option of linking to the original isn't ideal because the original is often much larger than needed). CSS rules for the profile to apply in the RTE window (float, width, etc)
  24. Nice module! A feature request: add an option for auto-linking images to a larger version of the same image, for use in lightbox enlargements. The core pwimage plugin for CKEditor allows for linking to the original image but often the original image is much larger than is needed, and I'd rather specify the enlargement settings myself than leave it to site editors.
×
×
  • Create New...