PDA

View Full Version : php image-scaleing



Exos Sho
June 19th, 2006, 05:04 AM
this is what the script looks like


<div style="background-color:#efefef;width:306px;border:5px solid #00c000;padding:1px;text-align:left;">
<?php

echo "control:<p>";
echo "original-name: $upfile_name<br>";
echo "size: $upfile_size Byte<br>";
echo "type: $upfile_type<br>";

$dname = explode(".",$upfile_name);
$dnamesize = count($dname);
$upfile_ext = $dname[$dnamesize-1];
echo "data-extension: " . $upfile_ext . "<p>";

if($upfile_size>0)
{
copy($upfile,$upfile_name);
echo "data has been copied in $upfile_name<p>";
echo "<img src= $upfile_name, width= "301", alt= "$titel">";
}
else
{
echo "copy-error: data does not exist";
echo " or false data-type";
}
?>
</div>

when this site loads, this error appears


Parse error: syntax error, unexpected T_LNUMBER, expecting ',' or ';' in C:\apachefriends\xampp\htdocs\upload\UC19.PHP on line 18

when I only write the source and not width, and alt, it works.
i d also like to know, how i can keep the properties of a pic, because i need a certain width of the pic, but dont know how big its gonna be
thx, in case u help me ^^

Danno
June 19th, 2006, 07:05 AM
line 18 says this currently:


echo "<img src= $upfile_name, width= "301", alt= "$titel">";

have you tried it with just this:


echo "<img src='$upfile_name' width= '301' alt= '$titel'>";

Maybe the commas and the lack of quotes were causing problems. Try that and let me know

Exos Sho
June 19th, 2006, 11:04 AM
^^ yes it works, and it even keeps the properties, i wasnt sure if it maybe only effect the width, thank u

Danno
June 19th, 2006, 12:39 PM
no problem, glad to help :D

bwh2
June 19th, 2006, 08:30 PM
ugh, clean it up a little:
echo '<img src="'.$upfile_name.'" width="301" alt="'.$title.'" />';

Exos Sho
June 20th, 2006, 03:11 AM
k^^