Jump to content


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


Image Manipulation Help

Recommended Posts

I have this image below and I would like to map a dvd cover to it...

[a href=\"http://img165.imageshack.us/my.php?image=layout2alphaa4fj.jpg\" target=\"_blank\"][img src=\"http://img165.imageshack.us/img165/5279/layout2alphaa4fj.th.jpg\" border=\"0\" alt=\"IPB Image\" /][/a]

Let me give you the info...
The dvd cover is always 1600x1074 and I the spine is always 70 pixels wide...

I know the exact x/y coordinates of the "template" - For instance, I would need to map the dvd cover's (0, 0) with the template's (60,75).

Do you understand what I want to do? How would I do this in PHP (What functions would I use etc.)?

Share this post

Link to post
Share on other sites
look at the gd library resources in the php manual:

[a href=\"http://www.php.net/gd\" target=\"_blank\"]http://www.php.net/gd[/a]

and also look into captcha tutorials, as this is basically the same thing, as far as combining things together.

Share this post

Link to post
Share on other sites
At another forum someone said the same thing...
Right now I just don't understand how to map the points (I have read over the GD function's summaries)...

Share this post

Link to post
Share on other sites
here is an example of the code below: [a href=\"http://www.bookmarkmania.com/crayon/test.php\" target=\"_blank\"]http://www.bookmarkmania.com/crayon/test.php[/a]
(no garauntees on how long the url will be valid) the background image is the gray border and the inside is blank white. the foreground image is the purple with the smiley face. the purple box with smiley face is transposed on top of the background.
//make a var for the background image
$image_bg = imagecreatefromjpeg('background.jpg');

//make a var for the foreground image
$image_fg = imagecreatefromjpeg('smiley.jpg');

$x_offset = 13; //how far to the right to transpose foreground onto background
$y_offset = 13; //how far down to transpose foreground onto background
$source_x = 0; //top position to start copy of image_fg at
$source_y = 0; //left position to start copy of image_fg at
$source_w = 338; //width of image_fg
$source_h = 249; //height of image_fg

//copy foreground image onto background image
imagecopy($image_bg, $image_fg, $x_offset, $y_offset, $source_x, $source_y, $source_w, $source_h);

//make a header for an image type
header('Content-type: image/jpeg');

// send the image to the browser

// destroy the image to free up the memory

Share this post

Link to post
Share on other sites
Thank you for the example...
The problem is I need to "skew" the image (Sorry if wrong term was used). The DVD cover is a 1600x1074 rectangle and I need it to fit on the white part of the template.

I can't just place the dvd cover over the background image and call it done. I need to put the dvd cover's (0,0) over the template's (60,75) as well as well as the dvd cover's (0,1074) at the template's (642,60).

I have 12 points total that I need to map - That is what I don't know how to do...

Share this post

Link to post
Share on other sites


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.