Jump to content

horst

PW-Moderators
  • Posts

    4,088
  • Joined

  • Last visited

  • Days Won

    88

Everything posted by horst

  1. what is returned via the AJAX request? what is in the logs? have you turned $config->debug to true?
  2. @mscore: Cool! What type(s) are available today, what do you use? The last great improvement in B/W films I can remember, was Kodak T-max 100, 400, 3200 with its so called t-grain, that results in smaller grain grids. The 3200 could be used nearly without light. Also, which film developer do you use? Own receipt or default one(s)? (dilution, time, temperature)
  3. I think it is for security reasons too, that not everyone can read config settings.
  4. foreach($pageOld->images as $image) { $pageNew->images->add($image->filename); } $pageNew->save(); $pageOld->images->deleteAll(); see: http://cheatsheet.processwire.com/files/page-files-multiple-wirearray/files-deleteall/
  5. Endless saving events are a sign that the ajax upload resulted in returning some PHP notice, warning, error via AJAX. That prevents the imagefield from updating correctly. You need to use the browsers Webtools and see what you get returned from the AJAX upload. ALso useful is to check manually in the assets/files/{12345}/ folder what files are there. (Your original file? A thumbnail? Nothing?)
  6. Hi, looks good. Only additional suggestion from me would be to use another upload path ($config->uploadTmpDir) if is set in your environment, but not really necessary. And you better should remove the temporary file after it got added to the image field. ... $i = 0; foreach($item_images as $data) { $name = $image_fileNames[$i++]; // fortunately i can pass this from ajax myImageExtract($p, $data, $name, $upload_path); } $p->save(); } function myImageExtract(&$p, $imgData, $imgName, $uploadPath) { $base64img = str_replace('data:image/png;base64,', '', $imgData); // TODO - must be dynamic - could be jpg, gif ... $data = base64_decode($base64img); $file = $uploadPath . $imgName; file_put_contents($file, $data); $p->item_images->add($file); unlink($file); // delete temp file after adding it to image field }
  7. Like Bitpoet and netcarver said, you need to save the page before you are able to add images. ALso you should do a check if the page already exists, maybe. If you are not able to provide (HTTP) URLs to the images, and no filepathes, but those strings of data:image/png strings, you need two things: a wrapper function that extracts the image data into a temporary file and an imagename! A wrapper function is easy, but from where do you get a filename, ...? <?php require_once('../index.php'); $input = wire('input'); $sanitizer = wire('sanitizer'); $pages = wire('pages'); $item_titel = $sanitizer->text($input->get("item_titel")); $item_client = $sanitizer->text($input->get("item_client")); $item_usecase = $sanitizer->text($input->get("item_usecase")); $item_text = $sanitizer->textarea($input->get("item_text")); $item_date = $input->get("item_date"); $item_images = $_GET["item_images"]; // don't know if we can use $input->get("item_images") to get an array, // writing in browser only(!) $parentPage = $pages->get("/items/"); $templatePage = wire('templates')->get("item"); $pageName = $sanitizer->pageName($item_titel); $p = $pages->get("name={$pageName}, parent={$parentPage}, template={$templatePage}"); if(0 == $p->id) { // or: if($p InstanceOf NullPage) // only create a new page if no one exists, // otherwise you would create pages with same content but automaticly incremented pagename !! $p = new Page(); $p->of(false); $p->template = $templatePage; $p->parent = $parentPage; $p->title = $item_titel; $p->item_titel = $item_titel; $p->item_client = $item_client; $p->item_date = $item_date; $p->item_text = $item_text; $p->save(); foreach($item_images as $data) { // $data looks like: data:image/png;base64,iVBORw0KGgo... $basename = '???'; $filename = myImageExtract($data, $basename); $p->images->add($filename); } $p->save(); } function myImageExtract($data, $basename = '') { // extract the imagetype / extension and the imagedata part from the string $imagedata = ... ; $extension = ... ; // write it into a temporary file and return the filename // see: https://processwire.com/talk/topic/11843-file-upload-images-pdfs-from-base64-value/#comment-110113 $tmpDir = new WireTempDir('someName'); $fileBasename = $basename . '.' . $extension'; $filename = $tmpDir->get() . $fileBasename; file_put_contents($filename, base64_decode($imagedata)); return $filename; }
  8. The more I use it, the more I love it. It simply is CSS: /*****************************************************************************************/ /** Transparent-Images Background **/ li.InputfieldImage div.gridImage__overflow, li.InputfieldImage .InputfieldImageEdit__imagewrapper > div > img { background: transparent; background-color: rgba(196,196,196,.7); background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAADFlJREFUeNo8lwl4jWcahu+TlUQkdrIJ0dgSDUKKMBI0toPWpKWlbRBMizJVpcxIOzpqacdQtUVoqdqiQpQQIvZYgyQqiIgkosgiEiRpzjz/Ob3mXNd/rnO+//+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CbknHXpHy1chUVF73wSPIWJJh4QZTs3I5JTNmY+x1uoiouGkNLSNlPv5QmlLUhtucGSDsHlUY9j9WBla8S1Slo4IHqP80ukg3Qq7RR8FDjfOIEbxEVN3ugUJqF5Vf4nTDz+pyHUW9rgqetMNYlyEmd5k1wyIBf8Yvxpq0gJaPHHmmjBP4B2fWZXBd55XIcpgth1Yj9rZj8TWO6iSVJgJab0S0+vouDMJqcLES/1aTcNOK2WdUP9eetO4ocOtAckcRHmrB9m+L7GsHwok2es6LqK8zOaZe2dBB3NysQH2RSfqKHfR+EUqQSupjaIMW4KhN2EUVjWaAVvLPhHZM1kbPGEgy5OrWWar0P/2h0j6jtdxMBgUNqshjho6EGUahVL+mjBD9Vu1MxDI/heH9VuD29B1uzTXsua8OeDFWu+t7N5D6y0QsE6utaB2r/jLo4gHfYBenesQM/pDtaZt4YIqlT9IXXCg8yd40T/JkOkNbmFT1HB2wgtnZxQXPus/pPkhQ/eAlbU37GduqlNG/r8W0NV7NKK5LSycm5oq1TQK2O1kBm9RmOV2UdmqdSNWJ6/fyJWQfKlNOPzF4oNaMzJQIV9gL43FWVwZ39lHnwiisymp1w1vvf0C0z5+nYplXPhE6I+R2j8Vw/nga1R4j8Xa5hl9AJvMq3sHd7QVzC7T4fGe8dM5BkiHC4ZseVzlUY2FGcDFXvAcLA3zI7TXqxaKlOr1s4kAnH2sMqyma/qOY+Qm/36kkumIz96usxZFgwDrDXM8SsdR6kH32Kq/5bsUhQODQ+SlGXTRI54ecGwrecKlN7EekyHApK5GpzBgu9ng52MAo/xNgAN8tgFKi3lETAAAAAElFTkSuQmCC"); background-size: 32px 32px; background-position: 0 0, 16px 16px; } li.InputfieldImage div.gridImage__overflow:hover, li.InputfieldImage .InputfieldImageEdit__imagewrapper > div > img:hover { background-color: rgba(55,55,55,.9); } /*****************************************************************************************/
  9. @LostKobrakai where must this be called? AFAIK, you define and / or add an array with (default) values and every thing else is done by PW. MyModule.module: MyModuleConfig.php:
  10. I would consider this an issue. If I get you right, it only doesn't work with the new approach? I assume, it has to do with the automaticly parsed / rendered method of PW, that reads your code (as default setting) and then overrides it with the current modules settings. No chance to override a setting for us. Butthis is a valid use case. I think we should make an issue on github and see, if Ryan can add this more fine grained control back for us.
  11. Some good news! I have experimented with the background for transparent images. I have tried lots of checkerboard images, with two or three colors, with alpha transparency or not. Finally I came to the conclusion that it is much better to use some photoshop noise. Here is my testimage. A png with black, white and midgrey text / symbols plus a grayscale full opaque and half transparent: And here is a screenshot how it looks as thumbnail in the images field with some noise background: This way we would not need any steroids, no config settings, nothing else.
  12. Have you checked the access settings for the field too?
  13. My code example is a bit lengthy. I copied it from an event template with another usecase. There we have a start_date and optionaly an end_date too. Only all future events and or currently active events should be shown on the site, also those where the start_date is in the past, but the end_date is in the future: $threshold = strtotime(date('d.m.Y 00:00:00')); $selector1 = "template=ptlist-events, event_disabled=0, event_date_start>={$threshold}, sort=event_date_start"; $selector2 = "template=ptlist-events, event_disabled=0, event_date_end>={$threshold}"; $events = $pages->find($selector1); // find all events that start today or in the future $events->add($pages->find($selector2)); // find all events that end in the future, even if they started in the past, // and add to PageArray $events->sort('event_date_start'); foreach($events as $k => $v) { printEvent($v); } PageArray stores by ID, so there are no duplicate entries in the final PageArray.
  14. I call boxes of filter links here via ajax on demand: http://joerg-hempel.com/archiv/ In the ProCached file, the content is empty. On demand it fetches it via ajax request, and on PW side via a page and urlsegments. You can use the network tab to view the request. But it is only requested one time per session. I store the fetched content in client browser local session storage, to avoid multiple server requests for the same content, if the user clicks around on the filter tabs.
  15. <?php $threshold = strtotime(date('d.m.Y 00:00:00')); // = today $selectorFuture = "parent=/shows/, show_date>={$threshold}, sort=show_date"; // or: sort=-show_date $selectorPast = "parent=/shows/, show_date<{$threshold}, sort=show_date"; // or: sort=-show_date foreach($pages->find($selectorFuture) as $show) { // echo table rows here ... } foreach($pages->find($selectorPast) as $show) { // echo table rows here ... }
  16. +1 for hiding the button by default (re-move the bookmark-thing from it) @Kai: I'm with you. The (unconfigured) button at such a prominent position is not useful. It produces confusion. But to clarify: the default behave of creating a new page in PW is to select / click on the parent page and select [new] from the popup link list. As LK has said, PW needs to know what page should be the parent for the new page. And now, imagine a site with lots (multiple thousand!) pages and lots of templates and a deep hirarchical tree structure. Do you have it? It would be very uncomfortable to first have to navigate deeply into the hirarchy and have to use the pagination too, before one coud select the parent page for creating a new one. This is the situation for what the ADD-NEW button was created for. Devs can setup template family relations and decide to display an AddNew link for a specific page type there. Now, when an autor / editor need to create a new page of that specific type, which parent is deep into the tree hirarchy, they only need to select it from the big ADD-NEW button and PW does the rest. It is a very fine, time saving, useful and comfortable feature. (when it not is showing up unconfigured ) We will add it to the issue list.
  17. Sorry, but I cannot resist: For me this sounds funny, as the index.php is wrapped around everything what has to do with / runs within PW, including 1k+ core files, all your site files, incl. templates, third-party modules and optionally other included scripts. Measuring the index.php execution time seems to be not the most useful concept for anything more than determining the total execution time. Also, if you have encountered times from 0.5 to 3-4 seconds for the same requests, it looks to me more to be server side issues than not performant coded templates or third party modules. If you would have encountered a request with a specific template to be always 3-4 seconds whereas others run under 0.5, this would be an indice for code bottle neck or that like.
  18. Congrats!
  19. Just to be safe: which version of PW? I assume PW 3+ or 2.8+ But regardless of that, you need to install this: http://modules.processwire.com/modules/image-animated-gif/ EDIT: For the record: We want to implement an equivalent of the above module into the PW 3+ / 2.8+ core. But I first need to modify / write it.
  20. Every thing is a page! Om! Every page has a ID! Om! $articleCountPerAuthor[$author->id] = $articleCount; Should be save!
  21. This should be read by @Pete. Maybe, this behave has to do with change of thread types? (formerly Question / Answer)
  22. Sorry, I forgot about it. Another solution would be to stick with PW 2.7 and the (old) SessionHandler-DB, but uploading multiple images packed into a ZIP! (only one ZIP at a time) This I uses on a client side with (old) SessionDB-Handler since PW 2.5, (upgraded to 2.6, then to 2.7) for years now, and it works correct!
  23. If you can, disable the session DB-handler. It is known for this behave in regard with multiple parallel images uploads. Or, if you cannot switch to session handling via files, the only other alternative is to switch PW Version up to PW 3.0.21+ (?) not sure the correct version where DB-Sessionhandler was updated / corrected. Other possiblities are not there in your case, I believe.
  24. Witch PW version is this on? Do you use DB-SessionHandler? Can you view Apache logs? Any entries there?
  25. @flydev: only one suggestion: it should be $child->numChildren(true) instead of $child->numChildren // what is the shortcut to $child->numChildren(false) Read here why: https://processwire.com/talk/topic/13950-show-image-childrens-children/#comment-125410
×
×
  • Create New...