Jump to content

Matthias

Members
  • Content Count

    20
  • Joined

  • Last visited

Posts posted by Matthias


  1. Hi there, hopefully i didn't miss something, but i have the following question: I want to show a square picture after upload, independent of the original aspect ratio of the uploaded image. But instead of cutting the parts of the original image, it should be filled up the empty spaces with white, so that in any case the full content of the uploaded original is visible.

    When i use something like
     

    $square = $page->original_uploaded_image->size(500,500); 

    The image will just be cropped. Did i miss something, are there options or any ideas how to ensure that all content will be still visible?

    Thanks :)
     


  2. 8 minutes ago, BitPoet said:

    Is the form data actually sent (what does the browser's network console say)? Is any 301 redirection happening for the request to the proceed page (and if yes, does adding a trailing slash help)?

    Thank you. The missing trailing slash in the form action argument was indeed the problem, causing a 301. (see screenshot attached)

    Now it works fine!

    So this is correct:
     

    <form id="my-form" method="post" action="<?php echo $config->urls->root; ?>proceed/">
      … etc …

     

     

    Bildschirmfoto 2016-10-28 um 15.19.51.PNG

    • Like 1

  3. Hi there together! :)

    Im trying to do the following:
     

    Having a simple template (page) form.php (form):

    <form id="my-form" method="post" action="<?php echo $config->urls->root; ?>proceed">
      <input type="text" name="firstname" value="john doe">
      <button type="submit">submit</button>
    </form>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    <script>
        $(document).ready(function() {
          $("#my-form").submit(function(e){
            var form = $(this);
            e.preventDefault();
            $.post(
              form.attr("action"),
              form.serialize(),
              function(result){
                form.html(result);
              });
            });
        });
    </script>

    posting "to" a simple proceeding template (page) proceed.php (proceed):
     

    <pre>
    <?php
    
    if($config->ajax) {
      echo 'proceed.php via ajax called!';
    }
    
    if($input->post->firstname) {
      echo 'hello, ' . $input->post->firstname;
    }
    
    ?>
    </pre>

    Everything works fine after hitting "submit" except that the POST data in $input is not found. So the result is:

    proceed.php via ajax called!

    and not as wished / expected:
     

    proceed.php via ajax called!
    hello, john doe


    Any idea why? Because of the serializing? Or maybe i have overseen something?

    Thanks a lot!

    Matthias






     


  4. Hi Zeka, thanks a lot for the links.

    I switched in my MAMP between PHP 5.6 and 7 and 

    if(empty($input->post->name)) { ... }

    works only in PHP 5.6 not in PHP 7. For whatever reasons, couldn’t find anything about this in the PHP Docs. 

    Yes, I'll change to the even simpler
     

    if($input->post->name) { ... }


    And say byebye to "empty" ;-)


  5. I have a strange one. inside my module class i want to check the user input, but it does not work like expected. Trying around since hours … what am i doing wrong. Any idea?

    I have a form, method=post, posting a simple text input "input_name".

    <?php
        public function ready()
        {
            echo $this->input->post->input_name; // echoes the name
            
            if (empty($this->input->post->input_name)) {
                echo 'no name'; // echoes "no name", too
            }
          
            $foo = $this->input->post->input_name;
            if (empty($foo)) {
                echo 'no name'; // echoes nothing, works.
            }
    }
    
    ?>

    The "empty" term seems not to work. Im going crazy with this (or $this …)! Is it something about namespaces? PHP7? 

    Any ideas?

    Thanks a lot!

     

     

     

     


  6. Hi there. This is a really nice script, and it works really fine! Is there a possibility to use it more than once in my project? I nee a simple contact form and more customized one for other requests. Can i "duplicate" the full script it maybe?

    Thanks for helping!

×
×
  • Create New...