Just your typical internet guy with questionable humor

  • 68 Posts
  • 2.24K Comments
Joined 3 years ago
cake
Cake day: June 22nd, 2023

help-circle
  • Simply changing the extension wouldn’t work because each image type has a specific header - even changing a .png to .jpg wouldn’t work - and organizes the actual image data in different ways.

    The header is what actually identifies the file type. For webp, it’s called the RIFF header and it must be 21 bytes (it’s a standardized specification, btw). For jpeg, the header is only 2 bytes and has the values FF D8. In theory, this means that you could even rename the file to image.zip and, if you opened it in an appropriate program, it would read the header and still render it properly
















  • Check out migrations.

    Only way to implement those is with a library, right? I did find this tutorial here (Building a PHP Database Migration System from Scratch: A Complete Developer’s Guide), so I might check and try it out sometime in the future

    Be careful with tricks.

    I am. Every time I have to deal with hashes here (all the time), I die a little bit inside

    you have a database field containing a list of comma separated IDs

    No, the column is just saving plain text, like Category: "video, blog, news" - from where I do the rest of the string juggling, there’s no second table involved in this.

    Wishing you lots of fun with your project!

    Thank you! 😄