I have a php page that has a form to upload files on my site. it uploads to /upload/popular/
after upload another php comes up with the statis information (filename and bytes of file) or if it didnt upload it has an error message. how can I get one of these php files to run the resize.php file. I tried both <? include ("head.php"); ?>
and <!--#include virtual="head.php"--> putting each as you see them in at the end of the file.
Heres the files Im trying I get this error Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /path/radupload/resize.php on line 8
upload1.php
<html>
<head><title>popular</title></head>
<body bgcolor="FFFFCC" style="margin: 1px">
<table border="1" cellpadding="5" width="100%" align="center">
<tr><td colspan="2" bgcolor="#0066cc"><font color="#FFFFCC" size="+1" align="center">Files Uploaded</font></td></tr>
<tr bgcolor="#ffff00"><td><nobr>File Name</nobr></td>
<td align="right"><nobr>File size</nobr></td></tr>
<?
/
SET THE SAVE PATH by editing the line below. Make sure that the path
name ends with the correct file system path separator ('/' in linux and
'\' in windows servers (eg "c:\temp\uploads\" )
*/
$save_path="/path/uploads/popular/";
$file = $_FILES['userfile'];
$k = count($file['name']);
for($i=0 ; $i < $k ; $i++)
{
if($i %2)
{
echo '<tr bgcolor="#FFFF99"> ';
}
else
{
echo '<tr>';
}
echo '<td align="left">' . $file['name'][$i] ."</td>\n";
echo '<td align="right">' . $file['size'][$i] ."</td></tr>\n";
if(isset($save_path) && $save_path!="")
{
$name = split('/',$file['name'][$i]);
move_uploaded_file($file['tmp_name'][$i], $save_path . $name[count($name)-1]);
}
}
echo "<tr style='color: #0066cc'><td>SSL</td><td>". (($_SERVER[HTTPS] != 'on') ? 'Off' : 'On') ."</td></tr>";
if(! isset($save_path) || $save_path =="")
{
echo '<tr style="color: #0066cc"><td colspan=2 align="left">Files have not been saved, please edit upload.php to match your configuration</td></tr>';
}
?>
</table>
<? include ("resize.php"); ?>
<p> </p>
<a href="http://kansasenterprises.com/hangarhobbies/">Back to WebSite</a>
</body>
</html>
resize.php
<?php
// Max height and width
$max_width = 177;
$max_height = 230;
// Path to your jpeg
$upfile '/uploads/popular/';
Header("Content-type: image/jpeg");
$size = GetImageSize($upfile); // Read the size
$width = $size[0];
$height = $size[1];
// Proportionally resize the image to the
// max sizes specified above
$x_ratio = $max_width / $width;
$y_ratio = $max_height / $height;
if( ($width <= $max_width) && ($height <= $max_height) )
{
$tn_width = $width;
$tn_height = $height;
}
elseif (($x_ratio * $height) < $max_height)
{
$tn_height = ceil($x_ratio * $height);
$tn_width = $max_width;
}
else
{
$tn_width = ceil($y_ratio * $width);
$tn_height = $max_height;
}
// Increase memory limit to support larger files
ini_set('memory_limit', '32M');
// Create the new image!
$src = ImageCreateFromJpeg($upfile);
$dst = ImageCreateTrueColor($tn_width, $tn_height);
ImageCopyResized($dst, $src, 0, 0, 0, 0, $tn_width, $tn_height, $width, $height);
ImageJpeg($dst);
// Destroy the images
ImageDestroy($src);
ImageDestroy($dst);
?>