001.
<?php
002.
003.
004.
005.
$photo
=
$_FILES
[
'photo'
][
'tmp_name'
];
006.
$photo_name
=
$_FILES
[
'photo'
][
'name'
];
007.
$photo_size
=
$_FILES
[
'photo'
][
'size'
];
008.
$photo_type
=
$_FILES
[
'photo'
][
'type'
];
009.
$detail
=
$_POST
[
'detail'
];
010.
$id_title
=
$_POST
[
'id_title'
];
011.
$id
=
$_POST
[
'id'
];
012.
013.
014.
015.
016.
echo
"$id_title"
;
017.
echo
"$id"
;
018.
019.
020.
include
"connect.php"
;
021.
for
(
$i
=0;
$i
<
count
(
$_FILES
[
"photo"
][
"name"
]);
$i
++)
022.
{
023.
if
(trim(
$_FILES
[
"photo"
][
"tmp_name"
][
$i
]) !=
""
)
024.
{
025.
$h2
=20;
026.
$images
=
$_FILES
[
"photo"
][
"tmp_name"
][
$i
];
027.
$new_images
=
"Thumbnails_"
.
$_FILES
[
"photo"
][
"name"
][
$i
];
028.
copy
(
$_FILES
[
"photo"
][
"tmp_name"
][
$i
],
"images_large/"
.
$_FILES
[
"photo"
][
"name"
][
$i
]);
029.
$width
=900;
030.
$size
=
GetimageSize
(
$images
);
031.
$height
=
round
(
$width
*
$size
[1]/
$size
[0]);
032.
$images_orig
= ImageCreateFromJPEG(
$images
);
033.
$photoX
= ImagesX(
$images_orig
);
034.
$photoY
= ImagesY(
$images_orig
);
035.
$images_fin
= ImageCreateTrueColor(
$width
,
$height
);
036.
ImageCopyResampled(
$images_fin
,
$images_orig
, 0, 0, 0, 0,
$width
+1,
$height
+1,
$photoX
,
$photoY
);
037.
ImageString(
$images_fin
,5,5,
$h2
-20,
"www.tscarcenter.com"
,
$light
);
038.
ImageJPEG(
$images_fin
,
"images_large/"
.
$new_images
);
039.
ImageDestroy(
$images_orig
);
040.
ImageDestroy(
$images_fin
);
041.
042.
echo
"Resize Successful.<br>"
;
043.
044.
$sql
=
"insert into tb_photo "
;
045.
$sql
.=
"(id_photo,name_photo,name_photo1,ref_title) VALUES ('$id','"
.
$new_images
.
"','"
.
$_FILES
[
"photo"
][
"name"
][
$i
].
"','$id_title')"
;
046.
047.
048.
mysql_db_query(
$dbname
,
$sql
);
049.
050.
}
051.
}
052.
053.
echo
"<H3>Uploaded </H3>"
;
054.
echo
"<A HREF='admin_photo.php?id_title=$id_title'> Back </A>"
;
055.
056.
057.
?>
060.
<head>
061.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=windows-874"
/>
062.
<title>Untitled Document</title>
063.
<style type=
"text/css"
>
064.
<!--
065.
body {
066.
background-image: url(pic1/bg2.jpg);
067.
}
068.
-->
069.
</style>
070.
<script type=
"text/JavaScript"
>
071.
<!--
072.
function
MM_preloadImages() {
073.
var
d=document;
if
(d.images){
if
(!d.MM_p) d.MM_p=
new
Array();
074.
var
i,j=d.MM_p.length,a=MM_preloadImages.arguments;
for
(i=0; i<a.length; i++)
075.
if
(a[i].indexOf(
"#"
)!=0){ d.MM_p[j]=
new
Image; d.MM_p[j++].src=a[i];}}
076.
}
077.
078.
function
MM_swapImgRestore() {
079.
var
i,x,a=document.MM_sr;
for
(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
080.
}
081.
082.
function
MM_findObj(n, d) {
083.
var
p,i,x;
if
(!d) d=document;
if
((p=n.indexOf(
"?"
))>0&&parent.frames.length) {
084.
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
085.
if
(!(x=d[n])&&d.all) x=d.all[n];
for
(i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
086.
for
(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
087.
if
(!x && d.getElementById) x=d.getElementById(n);
return
x;
088.
}
089.
090.
function
MM_swapImage() {
091.
var
i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=
new
Array;
for
(i=0;i<(a.length-2);i+=3)
092.
if
((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x;
if
(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
093.
}
094.
095.
</script>
096.
</head>
097.
<body>
098.
</body>
099.
</html>