1

我需要页面内的图像上传系统,以便用户可以在不离开个人资料编辑页面的情况下上传图片。当用户编辑他们的个人资料时,就像在 soundcloud 中一样。图片应上传,上传后应显示在个人资料编辑页面上。一切都是用 PHP 编写的,但我猜一些 javascript 必须在那里。如果已经有类似的东西我可以使用,请告诉我。

这是配置文件编辑代码

$username = $_SESSION['username'];
    $pass = $_SESSION['password']; 
  include ("../database.php");
   $result = mysql_query("SELECT * FROM members WHERE username='$username' AND     password='$pass' AND artist='Y'");

while($row = mysql_fetch_array($result)){

$artisturl = mysql_query("SELECT * FROM members  
WHERE username='$username' AND password='$pass'  AND artist='Y'");

while($row = mysql_fetch_array($artisturl)){
echo '<form action="phpscripts/artistupdate.php" method="post">
<input type="text" name="artistname" value="'. $row['artistname'].'" class="name"    maxlength="80"><span id="editlink"><t1>Your profile link will be: <br><a    href="http://newbornsounds.co.uk/artists/artist.php?artist='.$row['artistname'].'">    <b>http://newbornsounds.co.uk/artists/artist.php?artist=<FONT
 style="BACKGROUND-COLOR: yellow">'.$row['artistname'].'</font></b></a></span>
 <br><div id="urlwarn"><t1>Please note that if you change your url all the links you     have placed outside of NBS will be affected.</t1></div>';
}
}
?>
<hr>
<?php 


    $username = $_SESSION['username'];
    $pass = $_SESSION['password']; 
   include ("../database.php");
   $result = mysql_query("SELECT * FROM members WHERE username='$username' AND     password='$pass' AND artist='Y'");

while($row = mysql_fetch_array($result)){

       echo '<div id="artistsbio"><form action="phpscripts/artistupdate.php"    method="post">
       <textarea name="bio" rows="10" cols="80" name="bio" value="'.    $row['bio']. '" class="bio">'. $row['bio']. '</textarea><br>
       <div id="probwarn"><t1>Everything is still in the beta stage so there are bound to be a few problems. If you spot one please <a href="mailto:artists@newbornsounds.co.uk"><b>tell us about it.</b></a></t1></div>

       </div>';

}
?>

<a href="upload.html"><div id="imageright1edit"><img src="<?php  
   include ("../database.php");
   $result = mysql_query("SELECT * FROM members WHERE username='$username' AND     password='$pass' AND artist='Y'");

 while($row = mysql_fetch_array($result)){ echo ''. $row['image1'].''; }?>" width="100%"></a>
<a href="upload.html"><div id="imageright1edit"><img src="<?php  
   include ("../database.php");
   $result = mysql_query("SELECT * FROM members WHERE username='$username' AND    password='$pass' AND artist='Y'");

while($row = mysql_fetch_array($result)){ echo ''. $row['image2'].''; }?>" width="100%"></div></a>

<!-- This is the image upload select box-->
<input type="file" name="imageupload" value="Upload an image" class="filebutton"></div>

<input type="submit" name="submit" value="Done" class="button"></form>
4

2 回答 2

1
于 2012-06-07T15:14:25.687 回答
0

我从本教程中学习了如何做到这一点:

http://www.webmotionuk.co.uk/php-jquery-image-upload-and-crop/

它利用了 jQuery 的imgAreaSelect 图像裁剪插件

于 2012-06-07T15:11:28.030 回答