Jump to content

horst

PW-Moderators
  • Content Count

    3,482
  • Joined

  • Last visited

  • Days Won

    70

horst last won the day on October 8

horst had the most liked content!

Community Reputation

4,962 Excellent

About horst

  • Rank
    observer of the big picture
  • Birthday 11/05/1955

Contact Methods

  • Website URL
    https://nogajski.de/

Profile Information

  • Gender
    Male
  • Location
    Aachen, Germany
  • Interests
    Photography; PHP, HTML, CSS (SASS,LESS), JS;

Recent Profile Visitors

33,018 profile views
  1. try to increase the memory limit via .htaccess file php_value memory_limit 256M and check it by looking to the phpinfo() before you try to increase and afterwards, if it does take effect.
  2. Hey, lets pull it down to this: serving the full filesystempath should work everytime, if the file is_readable(), URL „may“ work most of the time, as the pdf-lib will expand it to the full filesystempath. In both scenarios finally the full filesystempath is needed to read, parse, import the imagefile into the pdf object. 😉
  3. I think you need to pass the full (absolute) filename to the mpdf->image() method, not a relative one and not(!) a URL. $filename = "/absolute/filepath/to/the/image.jpg"; // or when using PWs pageimage $filename = $image->filename; // do a test in your script for debugging: if(!is_readable($filename)) die('Missing file'); $mpdf->AddPage('L'); $mpdf->Image($filename, 0, 0, 210, 297, 'jpg', ...
  4. https://mpdf.github.io/reference/mpdf-functions/image.html
  5. 😢 @justb3a Good luck on your (new) way and many, many thanks for all your contributions !! 😄 ❤️ 👍
  6. @Jens Martsch - dotnetic, I had set it up some years ago under win7 with a (sort of) proxy batchfile. It is a single file, that I pointed the modules default protocol settings to. Don't know if this can be of help for you, as I hadn't read all the posts here. But here is the windows batchfile that I use(d): @GOTO START <?php $editor = "C:\\Program Files\\NuSphere\\PhpED\\phped.exe"; if($argc > 1) $url = $argv[1]; list($file, $line) = explode('&line=', str_replace(array('editor://open/?url=file://', ''), '', urldecode($url))); if(is_file($file)) { exec("\"$editor\" \"$file\" --line=$line"); } exit(0); ?> EXIT :START @ECHO OFF SET PHP=C:\php\php.exe %PHP% "%0" %* EXIT Short explanation: the batch script (maybe named something like "tracyopener.bat", located somewhere in the system path) is called with the tracy default params for file & line. the first line tells the win batch interpreter to skip the PHP section and start at the line where the php exe is defined the next line calls the PHP interpreter, passes the own script to it "%0", followed by all other params "%*", what is an alias for %1 - %9 when the PHP interpreter processes the script, the first line is interpreted as HTML or text output and therefor ignored. the next lines get and prepare the passed params for usage with my preferred editor NuSphere PhpEd, using the exec() function.
  7. Hi Jens, what Dragan said, if you can switch & test to PW 3.0.142 with the new implemented images subfields, that would be simple to setup and protect for usernames / ids and modified or uploaded timestamps. But you need to test it in a dev environment first, as it is "brandnew". I believe the best hook for all file and image related things on upload is >before "InputfieldFile::fileAdded" < (https://processwire.com/talk/topic/22252-admin-hook-image-upload-watermark-pim/?tab=comments#comment-190948
  8. I build and use one template that is bound to a single page in PW where both are simply named "ajax". I can access it per URL "/ajax/" and use it for everything that needs to send or retrieve data in the background. Here is an example from a project where different forms send data that need to be validated first and then send to final (external) destinations. The client browser optionally gets back HTML like "success messages" or error descriptions. <?php namespace ProcessWire; /*============================================================================== XXXXXXXXXX :: site/templates/ajax.php 2019-07-04 ==============================================================================*/ /******************************************************************************* * * This template file handles form submissions that are raised via AJAX! * * Sanitize, validate, log and submit to final destinations. * * // how the used JS looks like $.ajax({ url : gAjaxUrl, // /ajax/ type : 'POST', async : true, dataType : 'html', // returned data has to be HTML data : submitData, // submitted data object success : function(markup) { if('' != selector) { // a selector string to match the $(selector).html(markup); // markup container } } }); ... * *******************************************************************************/ // only process AJAX calls if(!$config->ajax) return 'WRONG ACCESS METHOD'; // only process POST requests with valid required if(!$input->post->hidden_id) return 'WRONG ACCESS METHOD'; // ... followed by all project specific validations etc. So, with your example I would check if there is a post value named theme, and if the value is one out of a whitelist of valid theme values: // does this belong to theme selection if($input->post->theme) { $validThemeValues = ['dark', 'light']; if(!in_array($input->post->text('theme'), $validThemeValues)) { header('HTTP/1.1 403 Forbidden'); return; } $session->set('selectedTheme', $input->post->text('theme')); return; } // does this belong to another thing? if($input->post->anotherThing) { // first validate, then process data // ... return; }
  9. Not 100% sure, as I do not work with options fields, but if you want to search for title values other the default language, you need to add the ID of that language to the fieldname. As example, if your italian language would have the ID 1020, you would have to query for: encyclopedia_item_type.title1020={$type} see:
  10. @ryan Oh WOW, a dream comes true! 😍 😍 😍 😍 😍 😍 😍 😍 😍 😍 😍 😍 😍 😍
  11. @David Karich & @kalimati Which PW version(s) do show this behave? AND: which ImageSizerEngine(s) have you enabled there? (GD | IMagick) We had a change in what image types are supported by IMagick and need to revert back some sorts of PNGs, especially 8bit PNGs are not correct supported by IMagick, and in very rare cases there also was wrong handling for some 8bit-PNGs in GD-Engine. Maybe you can provide the informations plus one or two of the (original uploaded) images in a ZIP to me?
  12. Yes, you will get it like with this code: $out = new \stdClass(); $out->clients = []; foreach([0=>['id'=>'abc'], 1=>['id'=>'xyz']] as $client) { $out->clients[] = $client; } header('Content-Type: application/json'); echo json_encode($out); see: https://www.php.net/manual/en/language.types.object.php#118679
  13. I believe this would result in erroneous JSON syntax. Your 'clients' need to be a (key or property) element of either an object or an array, not a preceding string.
  14. @Hardoman If I understand correct, you want to watermark the original image. Is this right? If so, you may want to watermark the original image directly. This way you don't need to delete the original image and copy / move around the watermarked variation. If you look into the PIM docs, you will find a description how to work on system files instead of Pageimage objects. This would be the way to go. see this post, the 3 tip: https://processwire.com/talk/topic/4264-page-image-manipulator-1/?tab=comments#comment-41748
  15. Hi @Noel Boss, - I haven't understand why you need init() and why you are not able to use ready(). (Maybe, because you haven't told 😉 ) But what about testing with prioritizing your hook(s)? Maybe with init() it may run lately, or in ready() (as one of the early birds), will do what you are after?? Links: https://processwire.com/docs/modules/hooks/#hook-priority and
×
×
  • Create New...