Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
limit image upload size
Old 06-06-2005, 03:16 PM limit image upload size
Yak Yak Yak Yak Yak

Posts: 593
Location: Rochester, MN
Trades: 0
I have the following code. I am trying to figure out a way to limit the size of images uploaded. Can someone help me with this?

PHP Code:
<?
include "member1.php";
$p=f(q("select * from profiles where id='$mid'"));
$m=f(q("select * from members where id='$mid'"));

$r=q("select picture, details from pictures where member='$mid' and type='Main'");
if (!
e($r))
{
    
$pic=f($r);
    echo 
"<br><center><IMG src=\"$ROOT_HOST/".piurl($pic[picture]).\"\" border=1 alt=\"$pic[details]\"></center><br>";
};
echo 
"<center><br>[<a href='http://www.gayhindu.com/messages.php?reply=1&to=$m[login]&subject=Hi, $m[login]!&message=...'> Meet this hottie! </a>]</center>";

if (!
$tm0web)
{
 
$p[yahoo]=$p[msn]=$p[icq]=$p[aol]="Sign up to see this information, it's FREE";
};

?>
<title>Gay Hindu Members</title>

  <table width="600" border="0" cellpadding="1" cellspacing="1" align="center">
    <TR bgcolor="#D5DFEE" class='tr1'> 
      <TD colspan="2" bgcolor="#FFFFFF"><strong><font size="2" face="Arial, Helvetica, sans-serif">Member 
        Details &gt;&gt;</font></strong></TD>
    </TR>
    <TR bgcolor="#000000" class='tr1'> 
      <TD height="3" colspan="2"></TD>
    </TR>
    <TR bgcolor="#f0f0f0" class='tr1'> 
      <TD>Country</TD>
      <TD><input name="country" type="text" id="country" value="<?php echo $m[country]; ?>" size="30" readonly="readonly"></TD>
    </TR>
    <TR bgcolor="#f0f0f0" class='tr1'> 
      <TD>State</TD>
      <TD><input name="state" type="text" id="state" value="<?php echo $m[state]; ?>" size="30" readonly="readonly"></TD>
    </TR>
    
    <TR bgcolor="#f0f0f0" class='tr1'> 
      <TD>Yahoo messenger username</TD>
      <TD><input name="yahoo" type="text" id="yahoo" value="<?php echo $p[yahoo]; ?>" size="30" readonly="readonly"></TD>
    </TR>
    <TR bgcolor="#f0f0f0" class='tr1'> 
      <TD>MSN messenger email</TD>
      <TD><input name="msn" type="text" id="msn"  value="<?php echo $p[msn]; ?>" size="30" readonly="readonly"></TD>
    </TR>
    <TR bgcolor="#f0f0f0" class='tr1'> 
      <TD>AOL messenger username</TD>
      <TD><input name="aol" type="text" id="aol" value="<?php echo $p[aol]; ?>" size="30" readonly="readonly"></TD>
    </TR>
    <TR bgcolor="#f0f0f0" class='tr1'> 
      <TD>ICQ number</TD>
      <TD><input name="icq" type="text" id="icq" value="<?php echo $p[icq]; ?>" size="30" readonly="readonly"></TD>
    </TR>
    
    <TR bgcolor="#f0f0f0" class='tr0'> 
      <TD>I'm a</TD>
      <TD><select NAME='sex' size=1 disabled="disabled">
          <option></option>
          <option <?php if ($p[sex]=="Male") echo "selected"?>>Male</option>
          <option <?php if ($p[sex]=="Female") echo "selected"?>>Female</option>
        </select></TD>
    </TR>
    <TR bgcolor="#f0f0f0" class='tr1'> 
      <TD>Who likes</TD>
      <TD><select NAME='likes' size=1 disabled="disabled">
          <option></option>
          <option <?php if ($p[likes]=="Males") echo "selected"?>>Males</option>
          <option <?php if ($p[likes]=="Females") echo "selected"?>>Females</option>
          <option <?php if ($p[likes]=="Both") echo "selected"?>>Both</option>
        </select></TD>
    </TR>
    <TR bgcolor="#f0f0f0" class='tr1'> 
      <TD>Occupation</TD>
      <TD><input name="occupation" readonly="readonly" type="text" id="occupation" size="30" value="<?php echo $p[occupation]; ?>"></TD>
    </TR>
    <TR bgcolor="#f0f0f0" class='tr1'> 
      <TD>Marital Status</TD>
      <TD><select NAME='maritalstatus' size=1 disabled="disabled">
          <option></option>
          <option <?php if ($p[maritalstatus]=="Single") echo "selected"?>>Single</option>
          <option <?php if ($p[maritalstatus]=="Married") echo "selected"?>>Married</option>
          <option <?php if ($p[maritalstatus]=="Divorced") echo "selected"?>>Divorced</option>
          <option <?php if ($p[maritalstatus]=="Coupled/Partnered") echo "selected"?>>Coupled/Partnered</option>
        </select></TD>
    </TR>
    <TR bgcolor="#f0f0f0" class='tr1'> 
      <TD>Height</TD>
      <TD><INPUT NAME='height' VALUE='<?php echo $p[height]; ?>' SIZE=8 readonly="readonly"></INPUT> 
        m </TD>
    </TR>
    <TR bgcolor="#f0f0f0" class='tr0'> 
      <TD>Weight</TD>
      <TD><INPUT NAME='weight' VALUE='<?php echo $p[weight]; ?>' SIZE=8 readonly="readonly"></INPUT> 
        kg </TD>
    </TR>
    <TR bgcolor="#f0f0f0" class='tr1'> 
      <TD>Skin</TD>
      <TD><select NAME='skin' size=1 disabled="disabled">
          <option></option>
          <option <?php if ($p[skin]=="Black") echo "selected"?>>Black</option>
          <option <?php if ($p[skin]=="Brown") echo "selected"?>>Brown</option>
          <option <?php if ($p[skin]=="Red") echo "selected"?>>Red</option>
          <option <?php if ($p[skin]=="White") echo "selected"?>>White</option>
          <option <?php if ($p[skin]=="Yellow") echo "selected"?>>Yellow</option>
          <option <?php if ($p[skin]=="Pink") echo "selected"?>>Pink</option>
        </select></TD>
    </TR>
    <TR bgcolor="#f0f0f0" class='tr1'> 
      <TD>Ethnicity</TD>
      <TD><input name="ethnicity" type="text" id="ethnicity" value="<?php echo $p[ethnicity]; ?>" size="30" readonly="readonly"></TD>
    </TR>
    <TR bgcolor="#f0f0f0" class='tr0'> 
      <TD>Eyes</TD>
      <TD><select NAME='eyes' size=1 disabled="disabled">
          <option></option>
          <option <?php if ($p[eyes]=="Black") echo "selected"?>>Black</option>
          <option <?php if ($p[eyes]=="Brown") echo "selected"?>>Brown</option>
          <option <?php if ($p[eyes]=="Green") echo "selected"?>>Green</option>
          <option <?php if ($p[eyes]=="Blue") echo "selected"?>>Blue</option>
        </select></TD>
    </TR>
    <TR bgcolor="#f0f0f0" class='tr1'> 
      <TD>Hair</TD>
      <TD><select NAME='hair' size=1 disabled="disabled">
          <option></option>
          <option <?php if ($p[hair]=="Black") echo "selected"?>>Black</option>
          <option <?php if ($p[hair]=="Brown") echo "selected"?>>Brown</option>
          <option <?php if ($p[hair]=="Red") echo "selected"?>>Red</option>
          <option <?php if ($p[hair]=="Blonde") echo "selected"?>>Blonde</option>
          <option <?php if ($p[hair]=="Blue") echo "selected"?>>Blue</option>
          <option <?php if ($p[hair]=="Green") echo "selected"?>>Green</option>
          <option <?php if ($p[hair]=="None") echo "selected"?>>None</option>
        </select></TD>
    </TR>
    <TR bgcolor="#f0f0f0" class='tr0'> 
      <TD>Languages Spoken</TD>
      <TD><INPUT NAME='languages' VALUE='<?php echo $p[languages]; ?>' SIZE=60 readonly="readonly"></INPUT> 
      </TD>
    </TR>
    <TR bgcolor="#f0f0f0" class='tr1'> 
      <TD>Details about me</TD>
      <TD><TEXTAREA NAME='details' cols=60 rows='4' readonly="readonly" wrap='PHYSICAL'><?php echo $p[details]; ?></TEXTAREA></TD>
    </TR>
  </table>
<br>
<?

    $r
=q("select id, picture, details, member from pictures where type='Public' and member='$mid' order by rdate desc");

if (!
e($r)) while ($pic=f($r))
{
 echo 
"<TABLE bgcolor=#E0E0E0 width=90% BORDER=0 CELLPADDING=1 CELLSPACING=1 align=center valign=top>";
 echo 
"<TR><TD align=center BGCOLOR=#F0F0F0 height=50 width=30%><a href=$ROOT_HOST/".piurl($pic[picture])."><IMG src='$ROOT_HOST/".piurl($pic[picture])."'  height=50 border=1 alt=\"$pic[details]\"></a></TD><TD BGCOLOR=#FAFAFA><blockquote>".nl2br(Htmlspecialchars($pic[details]))."</blockquote></TD></TR>";
 echo 
"</TABLE>";
};

include 
"_footer.php";
?>
__________________

Please login or register to view this content. Registration is FREE
neorunner is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-06-2005, 04:19 PM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
Hey, by size u can mean either the space it takes up (in KB or MB) and of course how big it is in terms of width and size, i would suggest looking at this tutorial : http://www.sitepoint.com/article/php...stem-minutes/4

Don't follow it tho, because the overall thing does not work, however it does explain GetImageSize in GD which i think is what you are looking for!
__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill

Please visit my sites:
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
leavethisplace is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to limit image upload size
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.17925 seconds with 12 queries