Home Community Mys-Script Creative Off-Topic |
|
|
Thread Tools | Display Modes |
#1
|
||||
|
||||
Dynamically Generated Images Addon
Before I begin, special thanks to Digital and Hare over at TGL. I couldn't have done this without them! (Link to original discussion)
What this does: This addon will use Imagick (a.k.a ImageMagick) to layer multiple images, compress them into one, and display them wherever you'd like without using AJAX. This can be used for backgrounds, decors, or dynamically generated pets. (Great for breeding sites!) I recommend you read the entire tutorial and then tailor it to fit your needs rather than following along right away. -Getting the images ready- As an example, I have my pet's layers saved as separate, transparent png images. Make sure they appear on top of each other properly! Also make sure all of the images are the same size, don't crop them! This can easily be checked in any art/art editing program that allows layers (I use FireAlpaca). Then it's on to the folder structure. You can set in up in the picuploads folder. This is how mine looks: -Step 0- On x10host: Installing Imagick is easy for you. Just navigate to CPanel and find "select PHP version". Click on it and look for the "imagick" plugin (should be in the second column). Check the box, hit save, and you're done! (If you're not on x10, your host might have this too. If not, continue to the second option below) On XAMPP/Other hosts: Whether you're using a XAMPP server or a host that doesn't allow the above, follow this tutorial: Link. If not using XAMMP, make sure you search google on how to install imagick on your host before taking this route! It could be different based on your host. -Step 1- Navigate to phpMyAdmin and get some columns set up in owned_adoptables. Use consistent naming conventions! It will make your life 100% easier in the long run I promise you. For the sake of this tutorial, I'm going to use my column names and code as an example. Here are the new columns I made with the names: -Step 2- Navigate back to the root folder and make a new php file to hold the Imagick code. (I called mine wolfimage.php) Inside, this is how it looks: PHP Code:
We're just about done! Don't believe me? Next I went to myadoptsview.php (called denview.php for me) and used this to get the image: PHP Code:
-Finale- -Imagick and relative paths- Imagick for PHP 5.4 does not like relative paths, so absolute paths are required for it to work. I'm not sure if that's still the case with newer PHP versions. -Playing with Imagick- The markings images for my wolves are actually really messy and don't fit inside the lines. I fixed this by using COMPOSITE_DSTIN, which does it for me. (Yay, laziness! The reason the base itself doesn't completely fit in the lines is because I neglected to do so on the image itself, not because of imagick) To use your own filters, just poke around here and try them out to see which ones you like: Clicky. -Backslashes vs. Forwardslashes- If you use XAMPP/WAMPP like me, you'll have to use double backslashes. If you're operating online, then you use single forwardslashes like any other URL. -Need help tailoring?- Just let me know in the comments if things are going wrong. I can help you out with it.
__________________
Last edited by Dinocanid; 12-17-2017 at 04:08 PM. |
|
|
What's New? |
What's Hot? |
What's Popular? |