Jump to content

requinix

Administrators
  • Posts

    15,055
  • Joined

  • Last visited

  • Days Won

    413

Posts posted by requinix

  1. CSV is text data. JPG is image data. It does not make sense to convert one to the other.

    ...unless you have some kind of specific knowledge about this process. Specific knowledge that nobody else probably has. So if your question is "is there a script out there made by someone to happens to share my specific knowledge" then the answer is no.

    Describe, with details, what it is you want to do.

  2. For simple applications, storing the file on a server is typically the easiest approach: file gets uploaded, you stick it somewhere that's accessible by the web server, and you can use a direct URL straight to the image.

    Breaks down when you have multiple servers. Doesn't support cases where you don't want just anybody on the internet to be able to see the image (though in this case you probably do want that). And backing up those images can be a pain in the ass.

    The alternative is storing the image in your database. Has overhead, like having to know the image file type and needing to provide some sort of script that can render the image, but the benefits may be worth it.

  3. :psychic:

    You're asking for advice about a specific implementation of something that I, and presumably many others here, have no idea about. What "function"? What "data set"? What "fields"? What is it that you're worried about "duplicating"?

    Then you say something about needing multiple database connections, which makes me worry...

  4. 56 minutes ago, phppup said:

    I've considered and toyed with the second container idea, but the issue there is that the gradient ellipse is  NOT distributed evenly on the "borders" of my vertically shaped div box (and this ALSO makes formatting text more challenging).

    The gradient runs from a single point in the center. Looking at the edges, the gradient will only be uniform if the container is in a circular shape itself - oval, I think. And even then, at 24px wide, you'll probably be stuck with some variation in gradient when comparing the outer and inner edges.

    In other words, it sounds like you need a different approach. I suggest keeping it simple: a special SVG that draws lines using your desired gradient, or go old-school and use plain images as in the days before CSS supported fancy borders.

  5. You can't use a gradient as a color. You can apply it as a border-image-source, but that may take some playing around with. But I'm not even entirely sure what effect you're going for, or the overall size/shape of the element you're styling (which will have a huge impact on the appearance of a gradient border).

    Or else you can just use a second container element, set the gradient as a background on the parent, then add padding to create the border effect.

  6. 6 hours ago, M.O.S. Studios said:

    I had the response sent to the console.log() function so I can more closely examine it. I was getting source code for the html page I wrote to send it

    Then either you didn't have PHP set up at all, and what you were seeing was the unexecuted source, or (I assume) you have some kind of logic like "if (form submitted) { do thing } else { show page }" and you weren't triggering the "form submitted" logic (thus it was returning the regular page instead).

  7. Looks normal...

    1 hour ago, M.O.S. Studios said:

    I have an API token, tried using the ‘Bearer’ authentication

    You do Bearer authentication by just including an Authorization header in the request. Like if it was any other header.

    1 hour ago, M.O.S. Studios said:

    and I either get a 500 error, or it sends back a response; but it’s just the html source of the page that is sending it.

    Was the 500 coming from your own site or from theirs? Presumably yours. A 500 means an error, so if you get that then check the server logs to find out what the error is so you can fix it.

    If the "HTML source" is of a page on their site then that likely means you were sending an incorrect request and/or to the wrong URL.

  8. If your script is working correctly then there will always be output - except in the case that there was no "register" submitted with the form. So first thing is to check that.

    Otherwise you'll have some sort of error. Make sure your php.ini is set up appropriately for a development environment by ensuring it has these two settings:

    display_errors = on
    error_reporting = -1

    (like at the bottom) and then restart PHP/the server/whatever you're using. You should then end up with a not-blank page...

  9. 1. Thank you for posting your reCAPTCHA secret to a public forum. Please cancel it and generate a new one immediately. And then don't publish it anywhere.
    2. The URL you're constructing has two problems, but they're irrelevant because:
    3. Per the documentation, you need to send a POST request to /siteverify. Not a GET request. Which typically means using cURL.

    If you still have problems, remember to post your updated code.

  10. 40 minutes ago, nlomb_hydrogeo said:

    I know some looping function like foreach might be used, but if I use it on the  $_POST array I'll get the values, not the keys.

    Is it possible you're not aware that foreach can give you both the keys and the values?

    That said, you shouldn't be going through every single entry in $_POST without verifying that it's good to add to your SQL. Really, you should be starting with the list of columns you want to support and then looking in $_POST to see what each one's value is.

  11. It'll be finding two versions because you do have two versions: it can't tell that the index.php one is "the homepage" and you're (I assume) using URL rewriting in the backend to map / to /index.php?route=common/home.

    Redirects are the answer, however they have to be very carefully done: redirect from the ?route= thing if that was the actual URL requested. Because if you don't have that little condition at the end, your server will redirect back and forth between them.

    How are your redirects set up now?

  12. Sounds like the preprocessing you're doing on your data, namely the $results array, doesn't suit your needs.

    Take a sample of your data and write it directly into your code, putting it into an array format that you can work with. Toy around with it until you get something that works. Then pull that stuff out and write code to generate the array from $data.

    Advice: it's totally okay to have something more complicated than a plain 3D array.

    array(
        some info here,
        sub data => array(
            maybe more info here,
            sub data => array(
                stuff
            )
        )
    )
  13. 2 hours ago, PNewCode said:

    I suspect this has to do with an id issue.

    That's correct: an ID will only ever refer to one element on the page, so using it for multiple elements is always incorrect.

    There's a simple solution for you here. Wrap the NOW PLAYING and the button (both) in a container element, then when the button is clicked, have it locate the container and then find the desired element to copy inside of it.

    IIRC:

    <div class="copy-container">
    	<div class="copy-target">NOW PLAYING: Something</div>
    	<button class="copy-button">COPY</button>
    </div>
    
    <script>
    document
      .querySelectorAll(".copy-container")
      .forEach(container => {
        const target = container.querySelector(".copy-target");
        const button = container.querySelector("btn.copy-button");
    
        button.addEventListener("click", () => {
          copyToClipboard(target);
        });
      });
    </script>

    And please don't implement clipboard functions like that - use the actual Clipboard API instead.

    • Like 1
  14. Moved.

    7 hours ago, unclesirbobby said:

    I am hoping to use php to build a website using offline using apache server.

    That is typically why people install Apache, or bundles like WAMP and XAMPP.

    7 hours ago, unclesirbobby said:

    Just to clarify I will be making a website using php to generate html files from text files. Then I will be able to change a template so that I can generate  lots of web pages easily. Has  anyone got any advice?

    First piece of advice is that generating HTML files is probably the wrong way to do this.

    How about some more information? What is it you're developing? What are these text files and HTML files?

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.