Jump to content

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.)?
Link to comment
https://forums.phpfreaks.com/topic/13181-image-manipulation-help/
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.
[code]
<?php
//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
imagejpeg($image_bg);

// destroy the image to free up the memory
imagedestroy($image_bg);
?>
[/code]
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...
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.