在与php中的灯箱相同的页面中打开图像

时间:2014-12-16 10:39:37

标签: php jquery lightbox

我创建了一个表单,其中有一个png图像作为水印和主图像。我必须在灯箱中打开它。我的代码如下所示:

if(isset($_POST['submit']))
{
// Load the watermark and the photo to apply the watermark to
$stamp = imagecreatefrompng('store/left.png');
$im = imagecreatefromjpeg('store/Lighthouse.jpg');

// Set the margins for the stamp and get the height/width of the stamp image
$marge_right = 500;
$marge_bottom = 500;
$sx = imagesx($stamp);
$sy = imagesy($stamp);

// Copy the stamp image onto our photo using the margin offsets and the photo 
// width to calculate positioning of the stamp. 
imagecopy($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp));

// Output and free memory
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
}

并且此代码的​​预览是:

enter image description here

当我在灯箱里时,我想这样做。我怎么能这样做?

1 个答案:

答案 0 :(得分:0)

<head>
<link rel="stylesheet" href="engine/css/vlightbox1.css" type="text/css" />
<link rel="stylesheet" href="engine/css/visuallightbox.css" type="text/css" media="screen" />
<script src="engine/js/jquery.min.js" type="text/javascript"></script>
<script src="engine/js/visuallightbox.js" type="text/javascript"></script>
<script src="engine/js/vlbdata.js" type="text/javascript"></script>
</head>
<body>
...
<div align="center">
<!-- Start VisualLightBox.com BODY section id=1 -->
<div id="vlightbox1">
...
</div>
<!-- End VisualLightBox.com BODY section -->
</div>
...
</body>