Jump to content

Qualtext

Members
  • Content Count

    24
  • Joined

  • Last visited

Community Reputation

8 Neutral

About Qualtext

  • Rank
    Jr. Member

Profile Information

  • Location
    Germany | Leipzig

Recent Profile Visitors

1,453 profile views
  1. Hi BitPoet, first of all: it´s only a test environment. I debugged a lot. I was focusing on this lines to let the question short as possible I know, it´s not a good idea. But i think, i found a bug, and i want to point this out. Nethertheless, i think there is an programming "mistake" in the Selectors.module. I followed the lines, and the splitting of the parts of selector doesn´t work right, (only!) IF, the field exists in the PW Installation, but isn´t appended to this template where the request starts, and its directly in the pages::find before hook. The output message is wrong: the selector operator is valid. The idea behind the hook is: i want that processwire jumps over declared pages (if you have a lot of pages (> 20000) and template (> 100)) to do some tests, batch processing, or to leave a bunch of pages unawares in whole system. Because the hook can do so mutch with one line of code, that all mehtodes like :find, :get, :children, :parent will be effected, i want to work with that, for fun, testing in a playground environment. My current solution is to hook in after an filter the $event->return. But filtering 20000 pages feels like wrong. I dont want that PW notice the 20000 pages. With HookAfter : $this->addHookAfter('Pages::find', function(HookEvent $event) { // Get the object the event occurred on, if needed $pages = $event->object; // An 'after' hook can retrieve and/or modify the return value $return = $event->return; // Get values of arguments sent to hook (if needed) $selector = $event->arguments(0); $options = $event->arguments(1); /* Your code here, perhaps modifying the return value */ $return->filter("loremipsum_field!=1|3|"); // Populate back return value, if you have modified it $event->return = $return; }); Again, i know, is not the best idea, but i wanto to try it. Ryan said that in some post too, i can´t find it anymore.
  2. Hi community, i want to add a selector to every pages->find() method. I found this hook solution, and Ryan mentioned this somewhere in this forum. https://processwire.com/api/ref/pages/find/ $this->addHookBefore('Pages::find', function(HookEvent $event) { // Get the object the event occurred on, if needed $pages = $event->object; // Get values of arguments sent to hook (and optionally modify them) $selector = $event->arguments(0); $options = $event->arguments(1); /* Your code here, perhaps modifying arguments */ // Populate back arguments (if you have modified them) $event->arguments(0, $selector); $event->arguments(1, $options); }); If i try to add something to the given $selector, the error occurs: Exception: Unknown Selector operator: '' -- was your selector value properly escaped? But the syntax is right, isn´t it? $this->addHookBefore('Pages::find', function(HookEvent $event) { // Get the object the event occurred on, if needed $pages = $event->object; // Get values of arguments sent to hook (and optionally modify them) $selector = $event->arguments(0); $options = $event->arguments(1); /* Your code here, perhaps modifying arguments */ $selector.= ", loremipsum_field!=1"; /* <----------------------- */ // Populate back arguments (if you have modified them) $event->arguments(0, $selector); $event->arguments(1, $options); }); What i am doing wrong? Thank you for your advice!
  3. Hi Community, is there a way to set up the quality value when processwire inserts an image in ckeditor (pwimage). First i thought this will manipulate all the image-resize-renderings: $config->imageSizerOptions = array( 'upscaling' => true, 'cropping' => true, 'quality' => 90, ); I want to reduce the quality (file size) of the cropped and directly used images. I found nothing in Forum and in the Blogs. It is an important thing for Google PageSpeed Insights for example. Can anyone take me to the right way?
  4. Hi Robin, i am using processwire 3.0.39 in the previous posts. Thats right. But there was no time to specify all steps before. Is it installed? I dont know why thats happend, or not happend. Maybe the hook is not called or the fieldname in fieldoptions changed. In the code of "SelectOrUploade.module" are these lines: /... $this->fields->addHookBefore('save', $this, 'extendPageFieldSave'); /... public function extendPageFieldSave($event) { $field = $event->arguments[0]; if($field->type=="FieldtypePage" && $field->useLibrary==1) { $field->set('template_id', $this->templates->get('name='.$this->item_template_name)->id ); $field->set('parent_id', $field->pageLibraryParent_id); $field->set('inputfield' , 'InputfieldPageSelectOrUpload'); $field->set('labelFieldName', '.'); $field->set('labelFieldFormat', '{title} {library_image.url}'); } } /... You could edit these lines to check, if the code is running, and the fields realy exists. public function extendPageFieldSave($event) { $field = $event->arguments[0]; if($field->type=="FieldtypePage" && $field->useLibrary==1) { $this->message('FieldtypePage with LibraryOption saving...'); //or foreach(array('template_id','parent_id','inputfield','labelFieldName','labelFieldFormat') as $fieldname) { $fieldtest = $field->get($fieldname); if($fieldtest) { $this->message('Field '.$fieldname.' was found.'); } else { $this->warning('Field '.$fieldname.' was NOT found.'); } } $field->set('template_id', $this->templates->get('name='.$this->item_template_name)->id ); $field->set('parent_id', $field->pageLibraryParent_id); $field->set('inputfield' , 'InputfieldPageSelectOrUpload'); $field->set('labelFieldName', '.'); $field->set('labelFieldFormat', '{title} {library_image.url}'); } }
  5. Hi, thank you for reply. I decided to build this module in another way. I think this works nice and is efficent for projects with hundreds of images, like Product-Catalogs. Ok, here is my brand new version module: image upload to another page upload and add to pages field image comparison to prevent duplicates basename comparison and pixel comparison search images by text (or show all) no more autocomplete-clone. A built a own Javascript to api logic to get images back. select images in an easy way drag n drop the imagepages like in imagefield to sort Because its extensive stuff, i decided to take a screen capture. I dont know how add a videocontainer here, so you have to download or open the following link in browser: Screen Capture http://download.frech-und-artig.de/selectOrUpload.mp4 (mp4, 91 MB) 3:35 = upload and select images 5:48 = image comparison 7:18 = image comparison with new page 8:00 = testing change of LibraryParent Image Preview Things that i have done: extended Image configuration fields hook in Page::saved to push uploaded images to new/other page ans check if page and image fields connected right to each other extended Page configuration fields hook in PageField::saved to control PageField Config hook in ProcessPageSearch to provide image thumbs instead of boring labels created new InputField "InputfieldPageSelectOrUpload" without pageAutocomplete cloning i added own logic to sortable / add / remove events etc I focused all the time to simplynes for user comfort. But one thing is anoying: that i have to use two fields: the image and the pagefield. I'd loving it, if there is a way, to setup only one field which is presenting two fields in one. How can i merge this? I leaved the bunch of $this->messages("...") in the module for now, because they explain some things and reports errors. What do you think? See zip in attachement. I hope you understand my amazing english skills. SelectOrUpload-0.0.1.zip
  6. Hi community, i'am not a pro in module creation and i need someone, who build it better. What my stuff at this time does: there is a page "Standard". This Page can upload into OR select Images from "Image Library". The pages inside "Image Library" are simple pages with a imageField (single) inside. The page "Standard" looks like this: "Select existing Images" ist a pageField. The Inputfield is a AutocompleteField with preview oh the selected pages (from "Image Library"). "Image (add if not exists)" is a imageField (multiple) this two fields togehter and some hooks are the core of my project. select a image form the list, or upload a new one. The Module has to parts: The new Autocomplete Inputfield for FieldtypePage and a processing for the imagefield via hooks. Lets start with the ImageField: Upload a Image(s) like everytime in Processwire. After hit "Save": a "Page:saved" hook is checking if the image is already in the Library is checking the basename. if basename already exists, the code compares the two images by pixelanalysis(!) if in Library already: then add the existing Page with this image to the PageField field if not: create a new page with template "Image", add the image there, and add the new page to PageField after all: remove the image from this page (because we linked the image via a page) The pageField is a clone of the existing InputfieldPageAutocomplete, but i extended that with little new function: display images in ___rendeListItem() and the javascript-version after AJAX loading. In my module, you can use as a new label specific string img:{a_image_field.url}:img. This pageField automatically controls the imageField. The selected Parent and Template is the path for new Pages and there Templates. I'am testing a lot with this new components. Works fine. I Like this solution for pages where many images are allways the same (like a product-catalog). Download the zip and have a look. Installation Follow this steps: Install module "InputfieldPageAutocomplete2" install module "ImageUploadOrSelect" create a Template "Image" now we need a unique name for three fields. For example: "loremipsum". create a field of type image, call it "imageuploadorselect_imagetarget_loremipsum". this field is single image field. no array output! add the field "imageuploadorselect_imagetarget_loremipsum" to template "Image". create a field of type image, call it "imageuploadorselect_imagestemporary_loremipsum". this field is multiple. array output! add this field to a template you decide. For example "basic-page". create a new field of type Page, call it "imageuploadorselect_pages_loremipsum". set up this field like in the image above. Parent: a page you decide (where pages with template "Image" will be created) Template: Image Labelfield: custom Custom page label format: {title} img:{imageuploadorselect_imagetarget_loremipsum.url}:img Inputfieldtype: "PageAutocomplete2". add this field to template from step 8, where the imageField also is. I would be very happy if someone could help. How i sad before, i'am not the pro. I looking for somebody who could help me to merge this stuff in one module to share it in the community. I commented all the things in the files. There are a lot of detailed information. Have nice weekend! modules.zip
  7. I used ProcessExportProfile in Processwire 3.0.3. The name fields can not have point character ".". If, than the site-profile is not detected. The generated config.php file needs the namespace at top, if generating new Classes in the config, like: <?php namespace ProcessWire; //... if(!defined("PROCESSWIRE")) die(); //... $config->custom_footer_scripts = new FilenameArray(); //own array for js at bottom of page I like ProcessExportProfile for new Projects — i hope the module is not buried.
  8. Same here. Try not use a dot (.) in profile name.
  9. Hi, i had never problems to upload images. The Server has anough memory. So huge images uploading well. But now, i have an Image from a Luma Smartphone, and this errors occurs. Argh. If i resave this Luma-Image in Photoshop, the upload-process and croping works very well. I test this on different Server/Webspace with Processwire 2.5 - its allways the same. May this "not a recogniced image" fails on EXIF or META Data or specific-Data in the file like Orientation, GPS-Datas or something like this in the Luma-Image? I found nothing on websearch like this. $additionalInfo = array(); $this->info = @getimagesize($this->filename, $additionalInfo); if($this->info === false) throw new WireException(basename($filename) . " - not a recognized image"); @ https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/ImageSizer.php#L260 I attach the image. Any else have trouble with Images from (this) Smartphones? btw: if i uploading the Luma-Image in this Forum-Thread this image will displayed. Why? May the Forum-Image-Script is the answer. luma_image_fail.zip
  10. Hi, i cant install the module, because ther is an error in DynamicRolesSupport.module-file. So the installation brakes, and many errors came up in processwire... Error on install Error: Call to a member function save() on a non-object... Replace Line 724 724: $droleEditSelector .= $multiplierNote; with 724: $droleEditSelector->description .= $multiplierNote; in DynamicRoleSupport.module an than $droleEditSelector->save(); working well. Error after repairing .module-file: Unable to install module 'DynamicRoleSupport': SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'droles-28' for key 'name_parent_id' If the module installation had this error before and you try to reinstall it, you have to delete the latest droles-templates and the created drole-page from the database – else the module cant install again. Hope somebody helps this.
  11. Hey, i'd like to use the InputfieldSelector to select Pages to load in Frontend via $pages->find($query). $query is the output of the InputfieldSelector. Thats nice for configuration-method for page lists via backend. But the sort-option "Descending By" doesnt storage after save – and the option jumped back to "Ascending By"-Value. Before Save After Save now i found this error on https://github.com/ryancramerdesign/ProcessWire/issues/887. But theres no solution. (May after save/reload the InputField cant handle the "-" after "sort=" ?) Thank You ProcesswireCommunity!
  12. Labels! This Label-Field in Template was never catching my Eye. Thank you.
  13. Hey, the green buttons at the end of the Table: why theres not displaying the template-name (in your screenshot)? I'd like to have something too, because users want to see something like "Text with to columns" instead of "layoutbox-text-columns_2". How this works? Is there a solution in processwire, also for "Add New"-Elements. Thank You! qualtext
×
×
  • Create New...