Jump to content

gebeer

Members
  • Content Count

    996
  • Joined

  • Last visited

  • Days Won

    23

Everything posted by gebeer

  1. This is basic PHP looping over an array. Since $blogimages is an array, you need to foreach over it to output every image in that array <?php $blogposts = $pages->find("template=blog-post"); foreach($blogposts as $blogpost){ $blogimages = $blogpost->images; foreach($blogimages as $image){ $imgthumb = $image->size(500, 300); echo "<img src='{$imgthumb->url}' alt='{$imgthumb->description}'>"; } echo "<h2><a href='{$blogpost->url}' >{$blogpost->title}</a></h2>"; echo "<p>{$blogpost->body}</p>"; echo "<br>"; } ?>
  2. Glad you sorted it! This is on purpose. Otherwise the filename would overflow the background area, especially on not so wide previews. Doesn't look very nice as it is, I know. In the CSS I had hyphens: auto; before but that would break the filename to the next line too soon. So I decided to go for word-wrap: break-word; instead.
  3. Really sorry for the trouble. Maybe caching issue? The 2 modules were never supposed to be installed alongside each other and I didn't take that into account since it is planned to replace the 'old' ImagePicker module with this one. Added a warning to my post above so others won't fall into that pit.
  4. Sorry for that one. InputfieldImagePicker did not manipulate any other image fields. Was your field 'image' created from InputfieldImagePicker? If so, you need to remove it and the error should be gone
  5. regarding that error. Do you also have my module ImagePicker installed on that site?
  6. Thanks for reporting. I was thinking about that one, too. But then I decided to allow only one images field because it might confuse users. But then, if I allowed multiple fields, the user could upload to any images field and have them available for the picker. Think, finally I will add this.
  7. I have made good progress and have a working version now, that allows to pick an image from a predefined page (and optionally its children), a folder inside site/templates or the page that is being edited. The version is available in the branch 'allinone' on github. Install from URL https://github.com/gebeer/FieldtypeImageFromPage/archive/allinone.zip If you find the time, please do some testing and report your findings. Thank you. If you test, please uninstall previous versions and install this one. EDIT: Also uninstall InputfieldImagePicker if you happened to install it. My code does not cater fully for DB update, yet. And since I switched field value storage to json, atm this has to be installed from scratch. The module is still on that repository. But eventually I will publish it on the ImagePicker repository when I feel it is ready. One thing I still have to solve: ATM the field returns 2 different objects for rendering in templates, depending on where the image comes from. If it comes from a page, you will get a Pageimage object. If it comes from a folder inside site/templates, you will get a custom ImagePickerFile object. The latter one cannot be manipulated (resizing/cropping) like a Pageimage but has some similar properties. I still have to find a way how to turn images from a folder that is not connected to a page into Pagimage objects. This is quite tricky. I wonder if anyone who is reading this has evr tried to accomplish something similar. I really always want to provide a Pageimage object, no matter where the real image file lives so that it can be manipulated. Still scratching my head on that but hope I will find a solution.
  8. You can have a look at my relatively new help videos module. Relevant code starts here. All the basics for creating fields and templates and pages are there. Should be easy to build upon. The uninstalling part goes in the ___uninstall() method. You basically need to keep track about what you installed (e.g. save this info to your module config data) and then remove that stuff.
  9. If you want to test it, you will have to use the branch jsonvalue from github.
  10. @adrian @eydun Made some progress and have a working version that is compatible with @Macrura's Settings Factory module. I switched to handling my field value as json. Haven't published the version yet as I'm planning on incorporating it into the yet to be developed new ImagePicker module. If you want to have a peek, I can publish it to a separate branch on github. Just let me know. First I was in doubt about using json for the field runtime value and for storage. But now I'm confident that this is the way I will go with the new ImagePicker module. So that one will be compatible with Settings Factory. The next days I will be working on combining this module and my ImagePicker (pick from folder) into one with the additional feature of letting the user choose an image from the page this field liveson. The resulting module will be released under the name ImagePicker. Hope I can get it out before Xmas.
  11. After giving it some more thought, I decided to merge the 2 modules and call the resulting ImagePicker. One thing I'm not sure yet how to best approach it: 1. should the options for choosing images from pages/folder/current page be exclusive, so that only 1 option can be set per field? Or 2. should it be possible to choose all 3 I guess, 2 makes more sense. The challenge will be to make the UI/UX of the inputfield lean, clear and easy to deal with. Instead of having the thumbnails underneath the preview image, I think with that many possible sources for images, it will be better to present them in a modal window.
  12. Makes sense. Only concern I have is that the field configuration options will grow to an extent which might overwhelm the user. This is why I had decided to make this a standalone fieldtype and leave the ImagePicker for picking from folders. I will contemplate some more and maybe combine the two.
  13. The use case you are describing does come up quite often. But I think this is going beyond the scope of this module. It advertises that you can pick images from predefined pages. And I don't really want to break out from that logic atm. But I'll put it on the wish list and see if I will add it as feature in a later version.
  14. Thank you very much for taking your time and putting this visual together! I don't really want to have icons next to the preview image because in future I might support selection of multiple images. Larger icon near the thumbnails might be a good solution. Also please understand, that I do not want to make this a hybrid between native image fieldtype and my fieldtype. The fieldtype now advertises that you can pick an image from another page. If it would also allow to upload to the page it lives on, it might become confusing to the user. If you want to stay consistent with the UI, it has ๐Ÿ˜‰ To me it looks odd having icons from different libraries on one page or even across pages. As long as there is an icon available for the framework I am using, I always prefer that one over an alien one.
  15. @szabesz had already mentioned it in this thread. But I think it is worth picking up again. I recently switched to https://vscodium.com/ and it is working absolutely great. It removes Microsofts branding and, more importantly usage telemetry. It is available for all platforms. Only drawback I could see is not having automated one-click updates. I'm all for open source and privacy. Microsoft's VS Code is based on the same codebase as VSCodium only MS adds their branding and collects lots of data because, well, that is just what they love to do. Being a Linux user for more than 15 years now, I really appreciate MS releasing this phantastic editor to the community. At least they are giving back a fraction of what they earned over the last decades with their half baked software which they make their beta testers pay a lot of money for. Ingenious concept, though...
  16. Yes, I will maintain that one, too. But don't think I will add any more features in near future. I think it is quite stable and can go in the modules directory. I'd have to look at Settings Factory first. It's new to me. Will let you know. Originally I was storing as json {"pageid": 1234, "filename": "filename.png"}. But then I realised that searching for filenames via API would be harder to implement. So I refactored to use 2 separate fields in the DB. BUT the issue for storing multiple files will come up when I decide to support picking multiple files. Then JSON would be the way to go, I guess (but not sure).
  17. Thank you for taking your time! I am using UIkit icons to be consistent with the UIkit admin theme. But I could switch to fa icons for users that still have the default theme enabled. This is what it would look like with fa-upload
  18. Happy to receive suggestions with visuals ๐Ÿ˜‰ Thanks for the idea. In my experience users hardly ever use image tags. They'd be a good way to categorize thumbnails, though. Will think about some more how to best implement this. Maybe automatically categorize if tags are there. Don't want to offer another option for this to avoid clutter in the field settings. You sure do love panels ๐Ÿ˜ Thank you! I thought about this option. 2 things that kept me from using panels: First, they don't offer hooking into close events easily out of the box like pw-modal. Second, in my opinion for this use case it is cleaner to have an overlay over the whole page. It is more distraction-free. But thank you for taking the time and demonstrating! Interesting thought. I'd say for those cases also offer a normal image field and then in your template render only the one that has content. What you describe sounds like a hybrid between normal image field and my fieldtype. Actually I am thinking a lot about how to best present the input for my fieldtype. And I'd love to use the standard image input from PW. Basically make my inputfield extend InputfieldImage or InputfieldFile and modify according to the needs. Only had a quick look and it involves quite a lot of changes to the original classes. It is on my personal wishlist and I will fiddle with it and see if I can produce something that makes sense and is usable without being confusing.
  19. I saw that one. It would add an attribute to the wrapping inputfield which in my case is InputfieldWrapper which does not allow attributes. I'd need them on the InputfieldMarkup fields which inherit InputfieldWrapper. So no way. Anyways I found a workaround and attached my attribute in my markup.
  20. Updated to v0.0.5 on github New features: optional Ajax loading of thumbnails. Especially useful when field is used inside repeaters or has many images. edit link right next to the thumbnails for the page that supplies the images. When clicked, the images field that holds the images will be loaded in a modal window. After making changes to the images and saving, the thumbnails are dynamically reloaded Side note: while working on these, I discovered that you cannot assign custom attributes to InputfieldMarkup and InputfieldWrapper (both inherit from Inputfield class) with $field->attr('data-sth', 'value'). $field->setAttribute() also doesn't work. Anyone else also experienced this? Is it deliberate or a bug?
  21. Thanks for testing. I have this behavior in my other module that allows to pick images from a single folder. But now that there is an option to also choose images from child pages, it would make the inputfield grow too high. Also if there are many images. I will implement ajax loading for the thumbnails on open and think that is better, especially for cases with many images or child pages or when the field is used inside repeaters. Good idea! Will add this. Maybe open in modal window and refresh thumbnails on close. Will be easy to implement once the ajax thumbnail loading is there. Thanks for the link. That would be one option but only works for installs which are up to date on the PW version. Repeater fields also open automatically if they have an error attached to them. That is another option. But implementation is quite complex. Still experimenting with this feature.
  22. Will do that. Also think it is better. Only have to find a way how to open the respective repeater field on that page and ideally scroll to it. There should be a built in way to do this. I remember having read sth about it but can't recall where it was.
  23. @adrian Yes, pretty useful ๐Ÿ˜Ž I tested this in repeater matrix context and it works, even the deletion prevention. Only thing which is not so nice: when you have this field inside a repeater, the edit links to the pages that contain the image references are pointing to the repeater pages, not to the pages containing the repeater field. Do you think this could boggle editors? They normally never see the repeater pages in the system.
ร—
ร—
  • Create New...