andy's php projects
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Script and site usage:
All of the scripts on this site are provided free for non-commerical, personal or non-profit use. If you find these scripts useful to you, appreciate the free support, or are just an all round nice person, then why not donate a little dosh? If you wish to use any of these in a commercial system, please refer to the payment plan.


Centering Image

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Drop Shadowed Thumbnail Creator
View previous topic :: View next topic  
Author Message
shaydez
Newbie


Joined: 06 Jan 2007
Posts: 2

PostPosted: Sat Apr 07, 2007 9:39 pm    Post subject: Centering Image Reply with quote

Hello,

I'm having a bit of trouble; and hoping you might be able to help me. I used your class to do AutoCrop and i'm using Drop shadow to resize the image to 3 different sizes. My next step is to put the cropped sized images into 3 different boxes.

100x100
250x250
500x500

now my problem is i can't get the cropped image to center x, y in the box

I don't see any thing in the class files for it unless i'm missing something

Thanks


Wanted to add i'm currently using this script.


function Image_Merger($filename, $box, $width, $height) {


// Get new dimensions
list($width_orig, $height_orig) = getimagesize($filename);

$ratio_orig = $width_orig/$height_orig;

if ($width/$height > $ratio_orig) {
$width = $height*$ratio_orig;
} else {
$height = $width/$ratio_orig;
}

//$divide_width = $width / 2;
//$centerpoint = $divide_width - ($width_orig / 2); // Center Image in canvas divide Cropped Image Dimensions
echo $width;
echo $width_orig;

$w1 = ($width_orig/2) - ($width/2);
$y1 = ($height_orig/2) - ($height/2);

// Resample & Save
$image_p = imagecreatefromjpeg($box);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, $w1, $y1, 0, 0, $width, $height, $width_orig, $height_orig);

echo "<br> Results from Division: $w1";

// Output
//imagejpeg($image_p, null, 100);
imagejpeg($image_p, $filename, 70);

}

for some reason it just doesn't want to center the image..
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Drop Shadowed Thumbnail Creator All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group