-
Posts
4,077 -
Joined
-
Last visited
-
Days Won
87
Everything posted by horst
-
Many thanks for making this! No please, +1 for let it as is (clicking anywhere)
-
@Jonathan: Many thanks for this nice module. I have played around with it the whole evening. The JpegOptim runs smoothly together with the ImageSizer and with the ImagickResizer. Following are some suggestions for you. If you find something useful, please feel free to take and implement it: The ImageSizer supports unlimited individual options for thirdparty modules, but it isn't documented actually. You can add any assoc option to the images $options array in templates. But you need to avoid overriding the core ImageSizers options. Therefor I have prefixed all options from JpegOptim with a jo, followed by the initial option name in camelcase style. Now the options are parsed in this order: default settings, config page settings, template / image-options settings! Example that overrides the default setting and custom setting for quality and threshold: $options = array('joQuality'=>85, 'joThreshold'=>20); $image->width(300, $options); I have introduced an option that temporary suppresses the use of JpegOptim on a per image basis: $options = array('useJPEGOPTIM'=>false); $image->width(300, $options); Also I have played around with the option for lossless optimization, but this seems to be nearly useless (not lossless ) because it produces the same result like quality 100 and threshold 1. I have left it in the code, just for documentation. I don't have added / tested these enhancements with the pageimage::optimize hook. So if you want to use some of the above you need to test / implement it there too. I have found out that the JpegOptim produces best results and also mostly smaller results if the GD or Imagick source is rendered with 100% quality. If you render them with e.g. 80% quality, the resulting filesize from JpegOptim is slightly higher (sometimes). This can be due to more jpeg artefacts in the result from GD or Imagick Also it seems best solution to use strong sharpening (over sharpen the resized variation, what is the source for JpegOptim). $options = array('quality'=>100, 'sharpening'=>'strong', 'joQuality'=>80); $image->width(300, $options); Different tests and results can be viewed here: http://images.pw.nogajski.de/jpegoptim/ PS: as I have explained in my previous post it would be nice to keep IPTC if populated PPS: here is the code that helps testing: https://gist.github.com/horst-n/4757d5a34f2278657b6d#file-jpegoptim-testroutine-php
-
@Jonathan: looks very interesting. Haven't tested now, but have one suggestion regarding metadata: You have set "--strip-all" as default. I really would like to see that IPTC-data would be preserved if populated. This is the default behave in ProcessWire since version 2.3.0. IPTC data only is present if people explicitly have populated them, and in this case they have highly interest in keeping that information within the images and its variations. IPTC data is really small, not like EXIF or XMP. The default is to strip everything but not IPTC. You simply can replace "--strip-all" by --strip-com --strip-exif --strip-icc Or Imagesizer can / should apply a public function that adds it to the resulting files of your and other third party modules. So with jpegoptim it would be a bit faster and more straight forward to use its own flags. ------ I will test it soon, together with ImageSizer, ImagickResizer and the PiM and report back the results.
-
The best thing would be, if the main ProcessDiagnostics comes together with a DiagnoseRoutine that mimics the same as the installer routine does. I think this is highly needed because of that most "installations" from dev to live do not run the installer process and its checks. Therefor this one should be bundled with the main module and should not be un/installable separately.
-
-
@Ivan: but you can tell the server if you want him to know it: https://github.com/serbanghita/Mobile-Detect
-
hhm, but this is not the solution. There must be something completely wrong, because if the images once are rendered, it should only took 0.02 seconds for each image, regardless if it is the first or the 19. ??
-
Yes, this is looking very weird. If it is on your local server, you can configure php.ini according to my suggestions above, (allowing set_time_limit(), etc). You need to check phpinfo().
-
I think only notifying, but no auto upgrade. It was discussed earlier. You need to manually compare and update .htaccess and site/config.php agianst a new version. Mostly the wire folder has no write access, or at least shouldn't have it.
-
as you can see all image renderings are less than a second. Only number 7 = nearly 3 seconds and number 8 is more than 10 seconds! It seems that this is a much to big image, maybe. Also the ini_set('max_execution_time', 30); seems to be disabled / forbidden on your server. I would try to get this enabled. Can you ask your hoster about this? Also you can try to use set_time_limit(30) instead first, but I guess this will be disabled too. You should have a look to your phpinfo() under safe_mode and disabled functions. Second point: do you really need that large images like under #8 that takes 10 seconds for rendering a 320 thumbnail? You can set a max dimension for width and height for the images-field under Setup -> Fields -> yourimagesfield -> Input -> Max Images Dimensions. This will render the uploaded image to these max dimensions (e.g. 1200 or 960 px or what ever you need) and takes this as source for all smaller sizes. Also it looks that your images don't get cached? Do they get recreated every time you run that script? This is not the normal behave and sounds very strange if so. ??
-
@David: this is already supported by the core ImageSizer. You can combine ImageSizer and PiM manipulations in any order you like: $croppedVariation1 = $image->size($width, $height, array('cropping'=>true))->pimLoad('prefix')->grayscale()->pimSave(); $croppedVariation2 = $image->pimLoad('prefix')->grayscale()->pimSave()->size($width, $height); // cropping is true by default in $config->imageSizerOptions in site/config.php If this doesn't suite your needs, report back please.
-
I'm not sure and haven't tested, but have you tried something like: pages->find("created_user_id=$userid") EDIT: Adrian wins!
-
Hhm, you are not looping through images but childpages. You may try to debug the times for the images rendering. Also you can do the resize to 320 and grayconvert in one step. <?php $timerstotal = array(); foreach ($page->children as $article) { ini_set('max_execution_time', 30); $timers = array(); $timer = Debug::timer(); $timers[] = Debug::timer($timer); // start image rendering $bw = $article->cover_image->first()->pimLoad('bw320')->width(320)->grayscale()->pimSave(); $timers[] = Debug::timer($timer); // finished image rendering ?> <a class="archive-item" href="<?php echo $article->url; ?>"> <div class="archive-item-img"><img class="archive-item-img-overlay" src="<?php echo $bw->url; ?>"></div> <div class="archive-item-text-container"><div class="archive-item-text"> <?php echo "<div class='archive-item-title'>".$article->title."</div>"; echo "<div>".$article->contributor->title."</div>"; ?> </div></div> </a> <?php $timers[] = Debug::timer($timer); // none image stuff finished $timerstotal[] = $timers; } // output timers echo "<pre>\n"; // or "<!-- \n" to output it as HTML comment var_dump($timerstotal); echo "\n</pre>"; // or "\n-->\n"; ?>
-
I have read Feb. 2013 in a board (I do not remember which) that someone said he is very happy about he has found ProcessWire after trying many other CMS for years. That lets me go to the site and after some reading I found the overview video. I loved how naturally and honestly he spoke over that CMS. Looks to me like real love. .(`'`)----(`'`)----(`'`). | '.' '.' '.' | | Ryan & PW | | | '(`'`)----(`'`)----(`'`)' '.' '.' '.'
-
There are no limits with this module but with your max execution time for PHP. add one line into your loop like here: foreach($images as $image) { ini_set('max_execution_time', 30); // this line resets the timer for max_execution_time with every loop. // following your code ... EDIT: It shouldn't take that long if images are already rendered. Please can you post your code of the loop here?
-
My DocumentRoot Path, (don't want it public)
-
This is the whole error. Nothing more, also no entry in the error.log.
-
@Nico: Loading the tab works now. Installing the Module (in general) works, also the module does its work, but when installing it I get a warning (with debug->true): Warning: Invalid argument supplied for foreach() in ...\wire\modules\Process\ProcessModule\ProcessModule.module on line 803 This is reproducable everytime I install the DiagnosticModules.module. So, in general it works, but there is something that seems not to fit 100%
-
@steve: here is a thread that fits into the section "Diagnostics needs a Module that checks the same things like the PW-installation-routine do". ------ @Nico: any progress on this one? :: https://processwire.com/talk/topic/6480-processdiagnostics/page-4#entry63854
-
This is something that should be included into the DiagnosticsModule, a check like it is done with the installation routine!
-
if this all doesn't work, one can get an info output of vhosts (with apache on windows) with calling: cmd /K C:\Apache2\bin\httpd.exe -S (replace C:\Apache2 with the path to your apache directory) This gives a screen like
-
Oh, that with the reverse order isn't an easy one. Files / Images are uploaded via ajax, and multiple of them asynchron, as Pete already said. On a site where the owner uploads many images at once via zip, I use a bootstrap script to let him rebuild the sortorder by name. The script only get invoked manually by clicking on a link. It is in the template, like the edit-link if a user is logged in and the page is editable: if($page->editable()) { echo "<a class='nav' id='sortimages href='/pwsortimages.php?id={$page->id}'>SortImages</a>"; } Here are the script code I use. If this can be handy for you, until someone comes with a better solution, you can sort by -created or -modified I think. <?php // define userroles that are allowed to work with this script, like: superuser|editor|author $userRolesSelector = 'superuser|editor'; //-------------------------------------------------------------------------------------------// // check if we have got an id $pageId = isset($_GET['id']) && is_numeric($_GET['id']) ? intval($_GET['id']) : false; if(false===$pageId) { header('HTTP/1.1 403 Forbidden'); exit(3); } // bootstrap PW require_once(dirname(__FILE__) . '/index.php'); // check user-account if( ! wire('user')->hasRole($userRolesSelector)) { header('HTTP/1.1 403 Forbidden'); exit(2); } // check if id points to a valid page $p = wire('pages')->get($pageId); if($p->id!=$pageId || !$p->editable()) { header('HTTP/1.1 403 Forbidden'); exit(1); } // now we reset the order for the images / files $p->of(false); $p->images->sort('name'); // -created ?? $p->save(); // and redirect to the page edit screen $url = wire('pages')->get(2)->url . "page/edit/?id=$pageId"; header("location: $url"); exit(0);
-
something like this should work: $tempPath = '/some/writeable/path/on/your/server/'; if($page->onefile) { $dest = $tempPath . $page->onefile->name; if(copy($page->onefile->filename, $dest)) { // http://www.php.net/manual/en/function.copy.php $page->setOutputFormatting(false); $page->files->add($dest); unlink($dest); $page->onefile->removeAll(); // or $page->onefile->delete($page->onefile->filename); ? $page->save(); $page->setOutputFormatting(true); } }
-
@teppo: I trust you! Meanwhile I have updated / edited my post above but have not noticed that you replied to it.
-
I do not mind that people should not play. But by my school days Orwell was still required reading. I just came to the conclusion that the large corporations seem to see people of all ages simply as beef cattle or slaves. In central Europe statistically every person up to age 70 buys for 4 million euros goods, including food, clothes, etc. (1 human == 4 million euros) Industrial food corporations don't want new born humans getting mother's milk. Why don't want they? I could go on and ask some questions about pharmacy cooperations or others, but the parallels should be clear already. Google want to install a global ring with new telecommunication Satellites. For this, they invest 3 billion euros. (or only dollars?) Do they do so just that people have something to play? I think no. And if someone now want to ask what Google and their glasses has to do with the industrial food corporations, well -, then it seems to be darker than I 've thought. (Google is a corporation with commercial interests. Their goods are informations and they sell them to who ever want to buy them, most likely to those who have much much much money.) ------ @teppo: No offence here, but if you think we live in a beautiful world and are free to do what we like, (and maybe you think I'm to old to be up to date with younger lifestyle) than go and ask some greek people in the same age as you are. If you don't know greek young people, go and ask some from spain or portugal. They all live in free democratic countries for more than 60 years, - not in repressive systems, - but only on the paper. ------ EDIT: I like some points of http://criticalengineering.org/en and if you have something like 'repair cafes' in your neighbourhood and go there, you will see that today mostly all of the technical goods have some quirks in it that are not good to the people who have buied them. It could be simple things like the primary transformer that scale down voltage to suite the needs of the actual good. It seems to be common now to built in components for higher costs but results in lesser quality. Example: in germany you have 230V and the electronic industry offers 'one piece components' that scale down the voltage to 12V with a max usage of 1 ampere (just an example, not sure if I recall all parameters right here). These components have a cost of 50 cent per piece for the corporation if they take some thousands. But now a days most corporations like to buy and built in components for a cost of 80 cent per piece that supports a voltage scale down to 15V. You can compare this with overclocking your PC RAM and CPU. The goods work fine but get more damaged with every minute you use it - and without any adavantages for you in the usage. Question: why do the corporations not want to save 30 cent per piece? (If they sell 10 million goods, there would be 1 million more income) If you like I can provide more examples: Recently we need to buy a new washing machine because the 4-5 year old one doesn't work anymore. After opening it we saw that only the carbon brushes of the electric motor were worn down. But we don't get new carbon brushes in the needed sizes anywhere. Also the electric motor wasn't build / designed to get opened in an easy way (like it was in the past for nearly every sized electric motors). That results in buying a new washing machine = costs 500,- euro. Carbon brushes would have cost 5 - 10 euros? And a professional repair service, for those who cannot do those things by themself, may have a cost of 50,- to 100,- euros? Having the the machine repaired has many benefits / advantages for the community / humans / nature etc., but not for the big corporations. So, I think one need some different points of view if a community builds a CMS / CMF framework or if a global corporation like Google does. The motivations and interests are different.