-
Posts
4,090 -
Joined
-
Last visited
-
Days Won
88
Everything posted by horst
-
If you do not have limitations for outgoing (SMTP) E-Mails per/Day or per/Month and if whether your company nor any other user on the same shared hosting is blacklisted in spam protection services, it should be pretty fine to send them on your own.
-
I posted you a link 2 month ago: I think it can be done with language alternate fields. Have you checked it?
-
To be honest, I don't know if this is a standard processwire file. But with language files one can use it as follows: Instead of adding each string to an own variable, you can add a second parameter to all the language strings you use around in different template files or module files or where ever you need them: __('Text 1', '/path/to/your/_strings.php'); __('Text 2', '/path/to/your/_strings.php'); ... And instead of adding the '/path/to/your/_strings.php' as text all the time, I use a functions call for that. This way you do not have to include the file and can use it everywhere handled through the PW translations system, because you tell it that the current string is the same as a string in the centralized _strings.php In /site/init.php I define this function, that simply returns the path to my centralized translation file: /** * TRANSLATABLE STRINGS * Include translatable strings */ if(!function_exists('ProcessWire\mystrings')) { function mystrings() { return '/site/_strings.php'; // absolute URL or absolute filepath to the central translation file } } My _strings.php would look like this: <?php namespace ProcessWire; /** * TRANSLATABLE STRINGS * Define globally available translatable strings * * USAGE * * __('Lesen Sie mehr ...', mystrings()); * * The function mystrings() returns the textdomain of this file. * **/ ... __('Datenschutzerklärung'); __('Die Maße des Werks sind:'); __('Dieses Bild drucken!'); __('drucken'); ... __('Text 1'); __('Text 2'); ... __('Zurück zur Übersicht'); To sum up, this way I don't need to include a _strings.php and it also works every where.
-
Animated GIF is getting spoiled on site at hosting
horst replied to Clarity's topic in Getting Started
This is an 360 x 600 px image and its file size is above 10 Megabyte ! Besides the question for what should this be useful, I would check the available memory usage on your online host. Only for creating the admin thumb when uploading that image it may need multiple 100 MB memory, depending on the number of slides in that image. -
1) Are you able to test the site (or a copy of it) with the current dev version 3.0.183/4 (what seems to become the next stable version next week) and check if the latest RepeaterMatrix version is on start too? 2) Also I want to see the exact code how you create the (primary png/jpeg) variations and where the webp() call is executed. Means the whole code for a picture / srcset elements markup please. No 1) would be just to be save that there are not already fixes in with the later version(s), and no 2) seems to be the only (for me known) point where the quirks may come from.
-
Normally they get removed together with the other variants, so there must be some sort of anomaly or quirks in your site happened. But without any informations where and how you create(d) the webp variations and where and how you remove(d) the variations, any help seems impossible.
-
When using urlencode, check if the + signs are changed too! Otherwise use a str_replace("+", "%20", $URL) additionally!!
-
I read something about better using ffmpeg and create videos from animated gifs. But I haven't done anything about it until now. If you are interested, it was in a book from Adi Osmani: Image Optimization My son uses ffmpeg a lot on CLI on linux. It's on my wish list to investigate further, but time is rare.
-
This is by design, because we have jpeg, gif and png as master images that can be used as originals for resizing, cropping, etc. and from the final variations optionally a webp can be created. The webp is called upon an regular page image object: $image->webp()->url. We would need a new Fieldtype or Inputfield for images only to collect and arrange images, without modifying methods. This could be able to support other file formats too. (TIFF, BMP or others maybe). But with the current image field, webp can't be handled as original image format. It's by design. Maybe an extention of the file field, that creates and displays a thumbnail additionally to the filename(s) would help?
-
Yes, webp only is an output format, not a source image or master image format. If you want to use only webp as original image and output image (WITHOUT resize methods) you can use it within a files field. Within image fields is not supported and doesn't make much sense.
-
Replace the original image with a resized variation of itself.
horst replied to Zeka's topic in General Support
Hi @Zeka I see, the DB data isn't updated by this method. Also when calling the ->width and ->height properties on image objects it returns the correct new values. But nevertheless we need to update the data in the DB too. (Also I don't know where or for what it is used ATM. ? ) I don't know any API method for updating this via page images or page files. The only thing I know is to alter it via the database object directly: $TABLE = "field_images"; $WHERE = "data='{$image->name}' AND pages_id={$page->id}"; $SET = "filesize=" . filesize($image->filename) . ", width={$image->width}, height={$image->height}"; $statement = "UPDATE {$TABLE} SET {$SET} WHERE {$WHERE};"; $pdoStatement = $database->prepare($statement); $res = $database->exec($pdoStatement); We need to update the filesize, width and height. Ratio is unchanged and can be kept. So depending on your route you already have the fieldname(s) and page id(s) stored in params. The above is a bare example that works but better should / can be used as a function. (?) -
Im not sure, are you speaking about form and formsubmission? Than have a look at pw $session. It has a method exactly for that (xrss validation). You find it in the API docs. Im on mobile sorry.
- 1 reply
-
- 1
-
-
Can removeHook() be used to skip one hook method when an event runs?
horst replied to netcarver's topic in API & Templates
Is it possible for the hook you want to skip to add a line of code that checks your conditions and act according to it? I mean, not to interact with the hook chain from within other hooks but acting within the system notification hook: if self registered user login stop logging, else proceed as default. -
Replace the original image with a resized variation of itself.
horst replied to Zeka's topic in General Support
You can resize the original image like this: // max width for landscape or max height for portrait $maxSize = 900; // then loop through images // get an image $image = $page->images->first(); // is it portrait or landscape? $portrait = $image->height > $image->width; // set properties according to image orientation $property = $portrait ? 'height' : 'width'; $width = $portrait ? 0 : $maxSize; $height = $portrait ? $maxSize : 0; // if the current size exceeds the max, proceed a resize if($image->$property > $maxSize) { $is = new ImageSizer($image->filename, ['quality' => 100]); // do not crucnch quality for original jpeg images !! $is->resize($width, $height); // resizes the original image, Attention: also wipes out EXIF data, XMP etc. - only IPTC is kept! } // DONE! // end of loop EDIT: @Zeka If you have any further questions, maybe in regard of CLI script processing, please ask. https://github.com/rolandtoth/PageimageRemoveVariations/blob/master/PageimageRemoveVariationsConfig.php#L121-L159 -
module PrivacyWire - Cookie Management & async external asset loading
horst replied to joshua's topic in Modules/Plugins
Hey, many many thanks! Works fine! Your support is extraordinary! ? ? ? -
This is a PDF-link to the public accessible Master thesis in the course of studies Computer Science and Media submitted by Gisela Andrea Kollotzek at the Stuttgart Media University on 06 May 2021 to obtain the academic degree of Master of Sicence (It is in german only): https://hdms.bsz-bw.de/frontdoor/deliver/index/docId/6650/file/Ausarbeitung.pdf
-
module PrivacyWire - Cookie Management & async external asset loading
horst replied to joshua's topic in Modules/Plugins
I have the following situation: in my initial html markup there is a PrivacyWire-ShowOptions link that gets initiated by the PrivacyWire module on content loaded. Every thing works fine, as expected. After that, I update a part of the html markup (with the PrivacyWire-ShowOptions link included) via AJAX. The initial link is gone now, and the new link is not bound to the PrivacyWire event. How can I bind it to the PrivacyWire event to show the options banner? A line of code or a keyword hint would be of great help. ? -
@Didjee Ah, now I see. My bad. The part C) explains how to (optionally) pass individual options for the rezising. And in the github readme the second param is described wrong. Its an obsolete function from the CAI3 for creating intermediate AND final images in one go, (what seemed nobody really has understand or used this). Now with CAI4 it behaves more like the core image field. But instead of passing the size|width|height as first argument, you pass the crop name. The second argument can be an individual options array (or for your convenience, a selectorstring representing the individual options). The irritation comes from the old readme. I need to update it to CAI4 changes! Sorry!
-
Not sure I understand correctly, but do you only need to have the width-200 image? You would need to call it like this: $page->images->first()->getCrop('portrait')->width(200)->webp->url; ALSO: If you already have called it once before, without the setting of "width=200", you have to forceNew=true or to removeVariations() before you call that. QUOTE: Is resizing still not working as mentioned in the first post of this topic? Will it work in a future release of CAI4? I don't understand this. Cannot find the post you mentioned also I'm not aware of resizing issues in general? All versions of CAI, (CAI2, CAI3, CAI4) have created resized variations. ??
-
Do you have a correct namespace set in top of your _main.php? Otherwise you may test in your testpage the following: <?php var_dump(function_exists('page')); var_dump(function_exists('ProcessWire\page'));
-
Add HTML markups dynamically in a JSON file with PHP
horst replied to Jules Vau's topic in General Support
We do not remove regular questions, also not when we have found a solution. We do share the solutions with the community.