Jump to content

Recommended Posts

Hey guys, So i've made quite a simple script that merges 3 images: A logo, background, and some text.

 

<?php
session_start();
$Bg = ($_POST['bg']);
$Logo = ($_POST['logo']);
$Text = ($_POST['text']);
$bg = imagecreatefrompng('$Bg');
$fg = imagecreatefrompng('$Logo');
$Final = imagecreatefrompng('$Text');
$x = imagesx($bg);
$y = imagesy($bg);
imagecopy($bg, $fg, 0, 0, 0, 0, 728, 90);
imagecopy($Final, $bg, 0, 0, 0, 0, 728, 90);
header('Content-Type: image/png');
$UID = "test";
$Path = 'test/' . $UID . '.png';
imagepng($Final);
imagepng($Final,$Path,9);
imagedestroy($bg);
imagedestroy($fg);
imagedestroy($Final);
?>

 

Now this works fine but I'de like to create it so that users can upload the 3 images to merge, Is there anyway to link a script like this to a form? Thanks very much guys.

Link to comment
https://forums.phpfreaks.com/topic/266389-uploading-images-to-merge/
Share on other sites

You're thinking a bit too complicated about this, try to reduce the task into simple steps and it should be a lot easier to see what you need to do.

 

A little example of what I mean, this is what you're looking to do:

Sig creator:
    - If form not submitted.
        - Show form & quit
    - If no files uploaded or error.
        - Show error
        - Repopulate form data.
        - Show form & quit.
    - Validate files & other input
    - If not validated.
        - Show error.
        - Repopulate form data.
        - Show form & quit.
    - Handle upload of files.
    - Merge pictures & text.

Makes it a whole lot easier to see what you need to do, doesn't it? ;)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.