Jump to content

uploading images to merge


sgt_fireman

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? ;)

Archived

This topic is now archived and is closed to further replies.

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