-
Posts
4,077 -
Joined
-
Last visited
-
Days Won
87
Everything posted by horst
-
for help with the native resizing methods, there is also PIA available
-
The owner of the site is a professional photographer, who needs to show (his) images at its best. And I suppose that his main clients are agencies / artdirectors who uses 30" monitors. Any regular "webimageshrinkingtool" is counterproductive here, I believe.
-
Recommendation: http://modules.processwire.com/modules/process-database-backups/
-
you might not need jquery
-
The dir is 755, but does the owner match the PHP / apache user too? If it is not writeable, you need to make it writeable. This has to do with your servers filesystem settings.
-
modifying $config property (e.g. siteSettings) from ready.php
horst replied to Macrura's topic in General Support
@bernhard: I use SPEX module that has support for this sort of things (and more). If the above really does not work for you, you may have a look into SPEX, how it is done there. It uses two hooks: https://github.com/jdart/Spex/blob/master/Spex.module#L150 & https://github.com/jdart/Spex/blob/master/Spex.module#L170 The relevant parts in the first hook for you are in line 155 157 and 164-165 (the rest is related to a profiler / logging, it is not relevant for you in the initial regard) If you want to try it out or build something own that need to rely on the method getTemplateVars(), please refer to its support thread (or better to the solution here) for a necessary code change when using it with PW 3.0+ -
Module: Spex: An asset and template management module
horst replied to Jonathan Dart's topic in Modules/Plugins
For all followers: A single line (250) needs to be changed to work with PW 3+. $include_fuel ? wire('all')->getArray() : array(), ( see this post: https://processwire.com/talk/topic/12298-update-273-to-308-processwiregetarray-does-not-exist/#entry114410 ) -
It does: $mail = wireMail(); $mail->attachment($filename); // string $filename or array $filenames what means: you can add any single file path as a string with the attachment() method, or you can add multiple files at once with its pathes stored in an array. Everything else, e.g. how you submit your form and / or upload the files, does not belong to WireMailSmtp. For this, you may find information and examples on php.net.
-
@kiennguyen1101: Very good findings! Looks good. And thanks for sharing!
-
You are calling $sanitizer in the scope of a custom function. There you need to call it with wire("sanitizer")->pageName(), or, if you need it multiple times in your function: $sanitizer = wire("sanitizer"); and afterwards you can use $sanitizer->pageName(). This behaves the same with all PW template vars, like: $config, $pages, $templates, $sanitizer, $session, ...
-
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 HTTP/1.1 200 OK Date: Thu, 24 Mar 2016 01:50:48 GMT Content-Type: text/html; charset=UTF-8
- 29 replies
-
- 1
-
- issues
- processwire forum
-
(and 4 more)
Tagged with:
-
you may look here: https://processwire.com/talk/topic/7850-user-admin-rolesthat-can-only-add-new-users-with-certain-roles/ You will need hook into before page::save and check if it should be a new user page, and if yes, if the current user has the right permissions or role.
-
For what do they have the permission user-admin-customer?
-
Looks like the server overwrite your setting after wiremail sends it. You need to refer to your server settings and change them.
-
If you haven't, you can read a bit in the docs here: https://processwire.com/api/modules/ Depending on what your module / class has extended, you may also use $this->pages->find() And if you use procedural functions, you can use function myFunction() { $pages = wire('pages'); $pages->find(); ...
-
The future: grid layout and flexbox (use it today with polyfill)
-
Handle form in module without autoload
horst replied to kiennguyen1101's topic in Module/Plugin Development
I don't think that you will get measurable performance diferences if one single module is autoloaded or not. You need to do early checks and returns, if it is (not) responsible for a request, so. If you want start it on demand, you can send the forms to a single page that is responsible for its processing. In the template you can invoke it on demand. But I think it isn't worth it. -
Another way could be to build and use an independent module and hook into after ImageSizer::resize instead building a (redundant) copy of a imagesizer engine module. Advantages: it will work with every (different) invoked imagesizer engine/s, and not only with the custom modified one! <?php namespace ProcessWire; class ImagesizerWithNginx extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Imagesizer with Nginx-Cluster', 'version' => 1, 'summary' => "", 'author' => "", 'autoload' => true, 'singular' => true ); } public function init() { $this->pages->addHookAfter('ImageSizer::resize', $this, 'uploadToNginx'); // Fired when a new or updated variation is created $this->addHookAfter('Pagefiles::delete', $this, 'deleteNginxfile'); // Fired when a file is deleted from a page } public function uploadToNginx($event) { $image = $event->object->image; $pageID = $image->page->id; $filename = $event->object->filename; $extension = $event->object->extension; // optionally optimize the image bfore upload, and then ... upload image to target } public function deleteNginxfile($event) { // see the S3 module } }
-
Given the following: you never show original images to the visitors, (what I highly recommend, as of the original should be in 100% quality, what would be much to high filesizes) every image variation is created through pageimage (= is a (new) imagesizer engine) it is possible to define a .htaccess directive for redirecting to the /site/assets/files/{ID}/{IMAGES} It should be possible to clone and modify one of the new Imagesizer Engines in that way, that you transport a copy of each created variation to the nginx cluster here in the image engine. Then the only other thing you need is a hook into Pagefiles::delete! So, you would need a module like this <?php namespace ProcessWire; class ImageSizerEngineIMagickNginx extends ImageSizerEngineIMagick { public static function getModuleInfo() { return array( 'title' => 'IMagick Image Sizer with nginx-Cluster', 'version' => 1, 'summary' => "Upgrades image manipulations to use PHP's ImageMagick library when possible.", 'author' => '', 'autoload' => false, 'singular' => false, ); } public function init() { $this->addHookAfter('Pagefiles::delete', $this, 'deleteNginxfile'); // Fired when a file is deleted from a page } // a complete copy of the original method, with addition of a call to the upload method as shown above, (line 342) protected function processResize($srcFilename, $dstFilename, $fullWidth, $fullHeight, $finalWidth, $finalHeight) { ... uploadToNginx($dstFilename); ... } public function uploadToNginx($imagefile) { // get the page id for the assets subfolder and get the basename of the $imagefile to build the target ... upload $imagefile to target } public function deleteNginxfile() { // see the S3 module } } PS: I would process the variations with 100% quality and pass the variations through an image optimizer like jpegoptim, just before you have to upload it. But I think that this is on your todo already.
-
Hi Dave, there is a module that handles files and image storage in S3-cloud. If there is no other / better alternative, I would fork this and change it to work with the nginx cluster (upload via FTP?) instead of the S3-cloud. At least, it can show you what hooks are needed: https://github.com/nmendes/AmazonS3Cloudfront/blob/master/AmazonS3Cloudfront.module#L52 An extra look needs to be to the filename variation creation for images. There was a change between PW 2.4 and 2.5.10. The module states compatibility to PW 2.4 only. But that can be due to no further maintenance through the author. If the filename variation creation is handled through PWs API (pageimage, pagefile, etc) I think it will be on the safe side and possibly working with recent PW versions too. EDIT: If the nginx and the main site have access to each filesystem, you simply may use symlinks for it. But as I first understand, the nginx is on a different machine, or not?
-
Thank you for the good news! (and the fix)
-
Return to home page is always to English (default) language
horst replied to hansv's topic in Multi-Language Support
If I understand right, you use: <a href="<?php echo $config->urls->root; ?>"> but you should use: <a href="<?php echo $pages->get('/')->url; ?>"> -
In permissions, I see: user-admin-all, user-admin-staff, user-admin-customer, user-admin-administrator. Have you tried to only give the administrator role permissions for user-admin-staff and user-admin-customer. I think you have, or not? If so, they will see in a user edit page the role of administrator too, but they cannot select/change them, like with the guest role. If one try to select / change the role, it is displayed a red warning: (You may not change this role). Or do you ask how to hide those roles?
-
PW3 index.php - symlink confusing assignment of $rootPath
horst replied to Gazley's topic in General Support
I'm using symlinks too, but I use it for the /site/... folders only, because I do not work on the wire/... folders: /www/public_html/wire/ == is physically in the htdocsdirectory of apache /www/public_html/site/ == symlinked to e.g. /Users/me/myproject/site/ /www/public_html/index.php == is physically in the htdocs directory of apache -
Yes you can read and write modules config data via PWs API for all modules. Please refer to the docs, or search the forum via google for something like $modules->get("WireMailSMTP")-> getConfigData(), or readConfigData() ? and ->writeConfigData($data). Sorry, I'm on mobile and cannot provide links or exact code snippets ATM. ---- EDIT: you can use this: $data = wire('modules')->getModuleConfigData("WireMailSmtp"); // or, regarding on scope, $data = $modules->getModuleConfigData("WireMailSmtp"); after modifying, you can write it back: wire('modules')->saveModuleConfigData("WireMailSmtp", $data); // or $modules->saveModuleConfigData("WireMailSmtp", $data);