Jump to content


Photo

Image Manipulation Help


  • Please log in to reply
4 replies to this topic

#1 pbjorge12

pbjorge12
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 29 June 2006 - 06:26 AM

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

#2 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 29 June 2006 - 06:41 AM

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.
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#3 pbjorge12

pbjorge12
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 29 June 2006 - 06:44 AM

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)...

#4 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 29 June 2006 - 07:58 AM

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

Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#5 pbjorge12

pbjorge12
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 29 June 2006 - 05:44 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users