-
Posts
4,085 -
Joined
-
Last visited
-
Days Won
87
Everything posted by horst
-
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. -
I do it very similar. I use a settings page with a unique template name where the family settings are restricted to use it only once (for a single page). Then I can connect to the content by using a selector with the template name. This way it is save, even if later the page gets deleted (by accident) and recreated. Also the user is free to rename its title and URL without interfering the content pickup in my initial codes. (Selector without ID, path, name, title, etc) For contact information I used a Pro Field of type Textareas some years, that was named contact. It subfields have names like company, phone, email, address or street zip city, etc. Including links of social platforms etc. Now I use the newer Pro Field type Combo(!) for this, as it allows more flexibility. In the site/templates/_init.php I use a snippet like this to serve a shortcut for the use in my templates to this content: // object: firstname, lastname, phone, mobile, email, ... $contact = (object) $pages->get('template=my-unique-templatename')->contact->data;
-
@mr-fan there is a method to send test email while debugging from within the modules page. Not the simple connection test. Have you used the verbose method and if so, what says the debug out? If you like, you can PM me that.
-
You can precede every desired module directory with a dot (.) to make it ignored by PWs module parsing. Example: site/modules/WiremailSmtp/ is picked up by PW, site/modules/.WiremailSmtp/ is ignored.