 |
|
|
02-22-2008, 04:11 AM
|
1 image over another
|
Posts: 115
Name: Sharon
Location: Leicester, uk
|
Hiya
how would i mae 1 image go over the top of another in php.. i need a little affect where 1 is 1/2 way over another.
I know you can do it with css but i have never touched that before and only need this in 1 place ... so is there a simple solution?
thanks
Shaz x
__________________
mysql_connect("localhost", "brain", "sharon") or die(mysql_error());
mysql error: brain doesn't exist!
|
|
|
|
02-22-2008, 04:44 AM
|
Re: 1 image over another
|
Posts: 1,226
Name: Mike
Location: Mataro, Spain
|
You may overlay two images physically with some image editor, if I understand you right.
|
|
|
|
02-22-2008, 07:06 AM
|
Re: 1 image over another
|
Posts: 115
Name: Sharon
Location: Leicester, uk
|
Yeah i know i could do it that way but this wont be fixed
__________________
mysql_connect("localhost", "brain", "sharon") or die(mysql_error());
mysql error: brain doesn't exist!
|
|
|
|
02-22-2008, 07:19 AM
|
Re: 1 image over another
|
Posts: 1,584
Location: Kokkola, Finland
|
can you give an example of what you mean?
|
|
|
|
02-22-2008, 08:22 AM
|
Re: 1 image over another
|
Posts: 310
|
You'd have to do it using CSS, can't be done using PHP. PHP can't affect the layout of elements on a webpage directly, you'd have to use XHTML and CSS.
|
|
|
|
02-22-2008, 01:52 PM
|
Re: 1 image over another
|
Posts: 4
Name: John
|
You can always modify this watermark code:
Code:
<?php
function imagelogo (&$dst_image, $src_image, $dst_w, $dst_h, $src_w, $src_h, $position='bottom-left') {
imagealphablending($dst_image,true);
imagealphablending($src_image,true);
if ($position == 'random') {
$position = rand(1,8);
}
switch ($position) {
case 'top-right':
case 'right-top':
case 1:
imagecopy($dst_image, $src_image, ($dst_w-$src_w), 0, 0, 0, $src_w, $src_h);
break;
case 'top-left':
case 'left-top':
case 2:
imagecopy($dst_image, $src_image, 0, 0, 0, 0, $src_w, $src_h);
break;
case 'bottom-right':
case 'right-bottom':
case 3:
imagecopy($dst_image, $src_image, ($dst_w-$src_w), ($dst_h-$src_h), 0, 0, $src_w, $src_h);
break;
case 'bottom-left':
case 'left-bottom':
case 4:
imagecopy($dst_image, $src_image, 0 , ($dst_h-$src_h), 0, 0, $src_w, $src_h);
break;
case 'center':
case 5:
imagecopy($dst_image, $src_image, (($dst_w/2)-($src_w/2)), (($dst_h/2)-($src_h/2)), 0, 0, $src_w, $src_h);
break;
case 'top':
case 5:
imagecopy($dst_image, $src_image, (($dst_w/2)-($src_w/2)), 0, 0, 0, $src_w, $src_h);
break;
case 'bottom':
case 6:
imagecopy($dst_image, $src_image, (($dst_w/2)-($src_w/2)), ($dst_h-$src_h), 0, 0, $src_w, $src_h);
break;
case 'left':
case 7:
imagecopy($dst_image, $src_image, 0, (($dst_h/2)-($src_h/2)), 0, 0, $src_w, $src_h);
break;
case 'right':
case 8:
imagecopy($dst_image, $src_image, ($dst_w-$src_w), (($dst_h/2)-($src_h/2)), 0, 0, $src_w, $src_h);
break;
}
}
// example:
imagelogo($image, $watermark, imagesx($image), imagesy($image), imagesx($watermark), imagesy($watermark), 'random');
?>
|
|
|
|
02-22-2008, 08:11 PM
|
Re: 1 image over another
|
Posts: 115
Name: Sharon
Location: Leicester, uk
|
I got it now thanks, i just did what mtishetsky suggested then when i wanted the normal image again i used a bit of javascript to change it
thanks
shaz x
__________________
mysql_connect("localhost", "brain", "sharon") or die(mysql_error());
mysql error: brain doesn't exist!
|
|
|
|
02-26-2008, 07:46 AM
|
Re: 1 image over another
|
Posts: 1,226
Name: Mike
Location: Mataro, Spain
|
Quote:
Originally Posted by Zhay
You can always modify this watermark code:
Code:
<?php
// code skipped
?>
|
It is not recommended to resize images with php. Some specially educated guys wrote and continue supporting a wondeful thing called ImageMagick.
|
|
|
|
|
« Reply to 1 image over another
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|