Jump to content

satal keto

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Everything posted by satal keto

  1. No unfortunately its not that I am using the wrong file, it gives the same result using both versions.
  2. Hello I am trying to get some code which will resize images which are uploaded to my website using a form. The code I am using to resize the images atm is function createThumbnail($imageDirectory, $imageName, $thumbDirectory, $thumbHeight) { $srcImg = imagecreatefromjpeg("$imageDirectory/$imageName"); $origWidth = imagesx($srcImg); $origHeight = imagesy($srcImg); $ratio = $origHeight / $thumbHeight; $thumbWidth = $origWidth / $ratio; $dst_img=ImageCreateTrueColor($thumbWidth,$thumbHeight); #imagecopyresampled($dst_img,$srcImg,0,0,0,0,$thumbWidth,$thumbHeight,$origWidth,$origHeight); imagecopyresized($dst_img,$srcImg,0,0,0,0,$thumbWidth,$thumbHeight,$origWidth,$origHeight); imagejpeg($dst_img,$thumbDirectory . "/" . $imageName); imagedestroy($dst_img); } The problem is when ever I try to run this code it is saying... where line 5 is I was wondering whether anyone had any idea's of some how that I would be able to resize the images without causing this error?
  3. I am creating a website for a friend of mine who is a model. One of the things that she would like for the website to do, is to allow her to choose a file that she wants on the website and then for using a simple form on the website to upload the file and then make a thumbnail of that picture. The code I am using for the creation of the thumbnail is... function createThumbnail($imageDirectory, $imageName, $thumbDirectory, $thumbHeight) { $srcImg = imagecreatefromjpeg("$imageDirectory/$imageName"); $origWidth = imagesx($srcImg); $origHeight = imagesy($srcImg); $ratio = $origHeight / $thumbHeight; $thumbWidth = $origWidth / $ratio; $dst_img=ImageCreateTrueColor($thumbWidth,$thumbHeight); imagecopyresampled($dst_img,$srcImg,0,0,0,0,$thumbWidth,$thumbHeight,$origWidth,$origHeight); imagejpeg($dst_img,$thumbDirectory . "/" . $imageName); } When I am running the script I am recieving the error message (Line 5 being "$srcImg = imagecreatefromjpeg("$imageDirectory/$imageName");") Now considering the original file was 426KB I think it using up 32MB is a little silly. So I was wondering whether I have made an error somewhere and this is causing the massive usage of memory.
  4. Thats gota be the shortest answer I have ever got But works beautifully (well some problems cause tried using it before htmlentities but can fix that ) THANKS
  5. I am presently making a website, one of the parts of this website is a messaging system. I have finished making the messaging system (well the graphics could do with a quick going over but ow well) but I have just found a problem. When the message is sent, although the message can be over many lines, it is shown (when viewed through the outbox or the inbox) on only one line. So for example Is shown in the inbox/outbox as The information is being sent to a PHP script from a textarea. The PHP script performs htmlentities on the variable holding the message (to reduce the security problems) and then stores the information in the database. I was wondering whether anyone has any idea's on how it would be possible to have the message to retain its formatting? Thanks for any help in advance Satal Keto
  6. I hate it when its something as obvious as that Thanks
  7. I am trying to create a simple messaging system for my website and I am having some problems with mysql_fetch_array(). the code I am using is; $query = "SELECT * FROM messages WHERE ToPlayer='" . $UserID . "'"; $result = mysql_query($query) or die(mysql_error()); $subject = "Inbox"; if (mysql_num_rows($result) > 0) { // If the user has messages $content = "<br /><table width='95%' align='center' border='1px'><tr><td>Subject</td><td>From</td><td>Date/Time</td></tr>"; while ($i = mysql_fetch_array($result, MYSQL_ASSOC)) { // For each result $MsgID = $i['MsgID']; $MsgSubject = $i['Subject']; $MsgMessage = $i['Message']; $MsgFrom = $i['FromPlayer']; $MsgDate = $i['DateSent']; $query = "SELECT Username FROM users WHERE UserID='" . $MsgFrom . "'"; $result = mysql_query($query) or die(mysql_error()); $result = mysql_fetch_array($result); $MsgFrom = $result['Username']; if ($i['Read'] == 1) { $MsgRead = true; } else { $MsgRead = false; } $content = $content . "<tr><td>"; if ($MsgRead == false) { $content = $content . "<strong>"; } $content = $content . "<a href='Msgs.php?view=Msg&MsgID=" . $MsgID . "'>" . $MsgSubject . "</a>"; if ($MsgRead == false) { $content = $content . "</strong>"; } $content = $content . "</td><td>" . $MsgFrom . "</td><td>" . $MsgDate . "</td></tr>"; } $content = $content . "</table><br />"; } The error message I am recieving is The code on line 37 being while ($i = mysql_fetch_array($result, MYSQL_ASSOC)) Now I have used exactly the same code in other area's of my website for the same sort of purpose but I haven't had this problem. I can't see anything wrong with that code at all but I am no expert at PHP I was wondering whether anyone else could see anything wrong with that code. Thanks for any help in advance Satal Keto
  8. no not images or txt files. Zip files rar files exe files really
  9. I have been trying to find out how to get a PHP script to download a file from another server (via HTTP not FTP) and save it to the server that is running the PHP script. I have been able to find out how to upload a file from say my computer and how to download a file from the server to my computer but not from one server to another. I was wondering whether anyone has any ideas on how I would be able to do this or somewhere which has information which would help me to figure this out Thanks for any help in advance Satal Keto
  10. I am trying to learn how to do OOP in PHP. But I am having a slight problem with my code I am using the following code <?php class HAPI { var $Login; var $Pass; var $Hapikey; var $Auth; function SetLogin($value) { $this->$Login = $value; } function SetPass($value) { $this->$Pass = $value; } function SetAuthKey($value) { $this->$Authkey = $value; } } $hyp = new HAPI(); echo "1<br>"; $hyp->SetLogin("Username"); echo "2<br>Login: "; echo $hyp->Login; echo " <-"; ?> For some reason this isn't doing anything. It is printing out Does anyone have any idea on what I am doing wrong? Thanks for any help in advance. Regards Satal
  11. Hi, I'm doing a project at the moment which requires the use of being able to create a database automatically when ever needed. So obviously creating a PHP script to get all the needed information and then create the database would be perfect. Here's the code I'm using <?php ///////////////////////// // MySQL Login details // ///////////////////////// $host = "localhost"; $user = ""; $password = ""; //////////////////////////////// // End of MySQL Login details // //////////////////////////////// //////////////////////// // Defining $database // //////////////////////// $database = $_COOKIE['fusion_user']; $bad_details = array("."); $good_details = array(""); $database = str_replace($bad_details, $good_details, $database); $database = $database{0}; $database = "database_$database"; // Used to test if database correct echo $database. "<p>"; // End of used to test if database correct /////////////////////////////// // End of defining $database // /////////////////////////////// ////////////////////////////////////// // Create Database if doesn't exist // ////////////////////////////////////// $conn = mysql_connect($host , $user , $password) or die( mysql_errno().': '.mysql_error() ); $query = "CREATE DATABASE IF NOT EXIST $database"; $result = mysql_query($query, $conn) or die(mysql_error()); echo "$result hi"; mysql_close($conn); ///////////////////////////////////////////// // End of Create Database if doesn't exist // ///////////////////////////////////////////// ?> I personally can't see anything wrong with that code, but yet it comes up with this response. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]database_1 Access denied for user: 'username@localhost' to database 'database_1' The problem is this script uses my highest privilage account. But yet this account cannot create the database. I know that its not that im not supposed to be creating database's (i have unlimited number of database's as part of my hosting). I was wondering if anyone could see any reason why this would be happening, I dont think its the code, but i want to make 100% certain before I start talking to my hosting company about this. Thanks alot Satal Keto
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.