Jump to content

horst

PW-Moderators
  • Posts

    4,085
  • Joined

  • Last visited

  • Days Won

    87

Everything posted by horst

  1. horst

    Avatar for pwired

    No, he isn't dead, he is swooning. Help is on the way:
  2. I get this when clicking on a ANSWERED button when in "view new content" mode: the link lacks the id of the post. &pid= ...
  3. horst

    Avatar for pwired

    BTW, my new avatar is a snapshot me looking to anttis new avatar, and I will only change my after antti has changed his. Maybe someone around here has a facebook account and can have a look if his wife has shot and uploaded another image?
  4. horst

    Avatar for pwired

    If you are already scared yet, you definitely shouldn't come after midnight when my brothers will visit the forum too: and
  5. This is a great solution. It is like "named parameters" (what isn't implemented in PHP but in some other languages). I definitely will play around with that and report back here.
  6. Actually you only can use the method removePimVariations() on a per image base to delete all your testfiles! $img = $page->images->first(); $img->pimLoad('prefix')->removePimVariations(); and they all are gone. But automaticly delete them when deleting a original image isn't supported yet. At least if you delete them manually in the backend. If you delete them via the API, there should be a simple way / workaround to get it solved. How do you delete them? When deleteing images manually in the backend: If you really have much changes and therefor a lot of orphaned files, you may use the lazycron module (core, but you have to install it first) together with the delete-orphaned-files script. It would be much better to get rid of that automaticly as you said, but I need to find the way how to do it. And within next weeks there are no time available for extending PiM.
  7. horst

    Avatar for pwired

    GOOD NEWS for those with little children or with a sensitive mind: I have written a VB program that permanently scans the screen for the pink colored string apeisa and than places a 100x100px black rectangle positioned x +30 and y +50 on top of that screen area. For all of you who have little children and can work on windows, I can sell a licence for only 12,- € (per day) and if you don't want like to have these scensored black rectangle you can upgrade to the premium version for only + 4,- € (per day). The premium version places the old avatar picture of antti on top of the screen.
  8. or I'm wrong? - It is output into JS.
  9. Martijn, sometimes I need some more headers, if not already set with apache or to override the apaches default. Maybe you find it useful. // collect infos $maxAge = (60 * 60 * 24 * 2); // 48 hours $imgTimestamp = filemtime($imgFilename); $imgExpiration = intval(time() + $maxAge); // create headers $imgHeaders = array(); $imgHeaders[] = 'Content-type: image/jpeg'; // or other type $imgHeaders[] = 'Content-Length: ' . filesize($imgFilename); $imgHeaders[] = 'Date: ' . gmdate('D, d M Y H:i:s',time()) . ' GMT'; $imgHeaders[] = 'Last-Modified: ' . gmdate('D, d M Y H:i:s',$imgTimestamp) . ' GMT'; $imgHeaders[] = 'Expires: ' . gmdate('D, d M Y H:i:s', $imgExpiration) . ' GMT'; $imgHeaders[] = 'pragma: cache'; $imgHeaders[] = "Cache-Control: max-age={$maxAge}"; //$imgHeaders[] = "Cache-Control: no-transform, public, s-maxage={$maxAge}, max-age={$maxAge}"; // public|private // send header foreach($imgHeaders as $imgHeader) header($imgHeader);
  10. That's the way I have done it. Now I am searching if / how it is possible to create another parallel branch (separate). On the Github website the (auto) forked repo has a "branch-1". I would like to have a "branch-2" too: forked-repo-| | |---- branch-1 (with changes) | |---- branch-2 (with other changes) Did someone know how to do it (directly on the GitHub website if possible)?
  11. An overview and tuto: http://www.devshed.com/c/a/PHP/Creating-a-PHP-PayPal-Instant-Payment-Notification-Script/
  12. This point I want double-like! (but it isn't an available feature)
  13. SELECT name,modified,modified_users_id FROM pages WHERE id=2
  14. horst

    Avatar for pwired

    Dresscode?
  15. I don't really know about that but have little intuition that it could have to do with the fact if one has already filled some fields of a repeater record but hasn't saved the page. Maybe these 'predefined' and than half 'prefilled' repeater records could have to do with it?
  16. Hi J1312, but this must work too! I haven't a 2.3 stable version installed here, only latest dev, so I cannot test. But it sounds not logical. What are the dimensions of the original image and what is the setting for upscaling? Maybe a typo in $options, please use: size( 80, 90, array('cropping'=>false, 'upscaling'=>true) ); OH, blink-blink: you also should use removeVariations() first, while testing. please use: $image = $page->images->first(); if($image) { $image->removeVariations(); // otherwise it may take a previous cached version instead of create a new one echo "<img src='{$image->size( 80, 90, array('cropping'=>false, 'upscaling'=>true) )->url}' />"; }
  17. Oh, sorry I have missread your post. I've thought using header set with only one value has worked. I think you first have to check if mod_headers is available.
  18. no - I've thought the theoretic way is to search via google or at apache: http://httpd.apache.org/docs/current/mod/mod_headers.html under examples 6)
  19. hhm, I'm not sure with apache stuff, but I think its some kind of wrong syntax. If you are more pragmatic then theoretic (like me), you may try: Header append Cache-Control "no-transform" Header append Cache-Control "private" and look if/what headers are sent.
  20. @vxda: and of course, for resizing you don't need the Pageimage Manipulator. It is enough to call ->width() on a pageimage: // example $pageimage = $myNewsItem->images->first->width(313)->url; But also your variable names are a bit confusing: your variable $pageimage contains only the URL. I would change this to avoid confusion: // example $pageimage = $myNewsItem->images->first->width(313); // and then $out .= "<img src='{$pageimage->url}' alt='' />"; References on how to work with images: http://processwire.com/api/fieldtypes/images/ http://processwire.com/tutorials/quick-start/images/ http://processwire.com/talk/topic/10-how-do-i-interact-with-the-image-field-in-processwire/
  21. If you don't want that in some particular situations, you can use HTTP-Header like Cache-Control "no-transform" for images! http://mobiforge.com/developing/story/setting-http-headers-advise-transcoding-proxies
  22. @RJay: yes that's right, - but also it is right that if you want to keep proportions and want that they fit into max dimensions for width *and* height you can call: size( $myMaxWidth, $myMaxHeight, array('cropping'=>false) ); For example: http://nogajski.de/priv/postings/rearrangedImageSizer.html#sizeNoCrop & http://nogajski.de/priv/postings/rearrangedImageSizer.html#sizeCrop
  23. Uuups, I haven't thought about that, but that's right. It would make it more confusing than it would help. That was exactly the intention of my post. I'm not totally sure but it looks to me that the possibilities with the options are not well known. Maybe bit more by coders than by designers, (- just to feed a prejudice). I have thought with the possibility to call a single option just before size is called could make it easyier | simpler | more popular.
  24. Hi Martijn, can you only use gif? (Newsletter with embedded cid: ?) You may try: function pimPng2Gif($im1, $rgb) { imagealphablending($im1, true); imagesavealpha($im1, false); $w = imagesx($im1); $h = imagesy($im1); $im2 = imagecreatetruecolor($w, $h); imagealphablending($im2, true); imagesavealpha($im2, false); $bg = imagecolorallocate($im2, $rgb[0], $rgb[1], $rgb[2]); imagefilledrectangle($im2,0,0,$w-1,$h-1,$bg); imagecopy($im2,$im1,0,0,0,0,$w,$h); imagedestroy($im1); return $im2; } $rgb = array(219,17,116); $png = $page->images->first()->pimLoad('png2gif',true); $gif = $png->setMemoryImage( pimPng2Gif($png->getMemoryImage(), $rgb) )->setOutputformat('gif')->save(); echo "<img src='{$gif->url}' /> {$gif->name}";
  25. Thanks both (Ryan and interrobang)! Just have added optional support for PiM-Variations too <pre><?php $keepThumbnails = true; $keepPimVariations = true; // Pageimage Manipulator Variations ini_set('max_execution_time', 60 * 5); // 5 minutes, increase as needed include("./index.php"); if($keepPimVariations) { if(!wire('modules')->isInstalled('PageImageManipulator')) { $keepPimVariations = false; } else { // PiM is installed, but is it a version that has method getPimVariations() (Ver 0.1.0 +) $a = wire('modules')->get('PageImageManipulator')->getModuleInfo(); $actual = preg_replace('/(\d)(?=\d)/', '$1.', str_pad("{$a['version']}", 3, "0", STR_PAD_LEFT)); $keepPimVariations = version_compare($actual, '0.1.0', '<') ? false : true; } } $dir = new DirectoryIterator(wire('config')->paths->files); foreach ($dir as $file) { if ($file->isDot() || !$file->isDir()) { continue; } $id = $file->getFilename(); if (!ctype_digit("$id")) { continue; } $page = wire('pages')->get((int) $id); if (!$page->id) { echo "Orphaned directory: " . wire('config')->urls->files . "$id/" . $file->getBasename() . "\n"; continue; } // determine which files are valid for the page $valid = array(); foreach ($page->template->fieldgroup as $field) { if ($field->type instanceof FieldtypeFile) { foreach ($page->get($field->name) as $file) { $valid[] = $file->basename; if ($field->type instanceof FieldtypeImage) { foreach ($file->getVariations() as $f) { $valid[] = $f->basename; } } // keep thumbnails: if ($keepThumbnails && $field->type instanceof FieldtypeCropImage) { $crops = $field->getArray(); $crops = $crops['thumbSetting']; $crops_a = explode("\n", $crops); // ie. thumbname,200,200 (name,width,height) foreach ($crops_a as $crop) { $crop = explode(",", $crop); $prefix = wire('sanitizer')->name($crop[0]); $valid[] = $prefix . "_" . $file->basename; } } // what's about PimVariations ? if ($keepPimVariations) { if ($field->type instanceof FieldtypeImage) { foreach ($file->pimLoad('x',true)->getPimVariations() as $f) { $valid[] = $f->basename; } } } } } } // now find all the files present on the page // identify those that are not part of our $valid array $d = new DirectoryIterator($page->filesManager->path); foreach ($d as $f) { if ($f->isDot() || !$f->isFile()) { continue; } if (!in_array($f->getFilename(), $valid)) { echo "Orphaned file: " . wire('config')->urls->files . "$id/" . $f->getBasename() . "\n"; // #unlink($f->getPathname()); } } wire('pages')->uncache($page); // just in case we need the memory }
×
×
  • Create New...