Jump to content

Swarfega

Members
  • Posts

    38
  • Joined

  • Last visited

Everything posted by Swarfega

  1. Thank you, I fixed it by adding ini_set('post_max_size', '64M'); ini_set('upload_max_filesize', '64M'); As I don't have direct-access to my PHP.ini file. (If anyone else encounters this, just use this) However, it does still seem to have the tendency to randomly timeout and simply close the connection by the server. The image and the data is still loaded/inserted, but the timeout would ultimately cause a user to press the Back Button, which regardless of having used the Header[Location] function, would re-send the data. Pity. :/ I'll try work that out as well!
  2. Hey. So I've loaded up, what I think, is a pretty neat Image Rezise script on my website, storing the image Path data md5 hashed in a MySQL database, and then loading it through a script on a page, but I have a problem. If the Image is very large or the pixels/quality of the image is very 'complex', the Image Resize script simply stops writing the new file and leaves it at 33kb. Does anyone have a clue why it would do this and if so any possible solution? Here's what happens: http://i45.tinypic.com/r2njw3.png Naturally since the Script stops writing the new image file, there's nothing for the Display Script to actually display, which is a huge issue with its purpose in consideration. EDIT: Forgot a code snippiet, sorry. $this->modifyImage($image, 50, $md5 ); $this->modifyImage($image, 70, $md5 ); $this->modifyImage($image, 255, $md5 ); $this->modifyImage($image, 400, $md5 ); $this->modifyImage($image, 800, $md5 ); function modifyImage( $image, $size, $md5 ) { switch( $this->extension ) { case '.jpg' : $imageX = imagecreatefromjpeg( $image ); break; case '.jpeg' : $imageX = imagecreatefromjpeg( $image ); break; case '.png' : $imageX = imagecreatefrompng( $image ); break; case '.gif' : $imageX = imagecreatefromgif( $image ); break; } $X = $size; $Y = $size; $IRes = getimagesize( $image ); $OX = $IRes[0]; $OY = $IRes[1]; $imagep = imagecreatetruecolor($X, $Y); imagecopyresampled( $imagep, $imageX, 0, 0, 0, 0, $X, $Y, $OX, $OY ); switch( $this->extension ) { case '.jpg' : imagejpeg($imagep, CWD2 . $size.'_'.$md5.$this->extension, 100 ); break; case '.jpeg' : imagejpeg($imagep, CWD2 . $size.'_'.$md5.$this->extension, 100 ); break; case '.png' : imagepng($imagep, CWD2 . $size.'_'.$md5.$this->extension, 100 ); break; case '.gif' : imagegif($imagep, CWD2 . $size.'_'.$md5.$this->extension, 100 ); break; } } Thanks!
  3. <td style='max-width: 600px; overflow:auto; word-wrap:break-word;'> Fixed the issue by doing this, if someone else encounters this.
  4. Hi. I've got another issue. Basically, I'm using a while loop to drag all the Data from the database to display on a page. Consider it a 'Guestbook', if you will, except for all users. (Chat) The problem is that I can't find any legit way using <td> tag-attributes to lock the Message in its place (I have this issue on the normal GuestBook invidiual for each user as well). I'm better of just showing you what I'm talking about: http://i49.tinypic.com/qoyd8l.png I want the <td> Tag to display the whole message, but once it reaches the drawn-Red line, I want it to make a new line and keep the message flowing like that until the message has been fully printed. I've tried the following: - <td width='xx'> Tag - <td class='xx' width='xx'> Tag (CSS) And nothing thus far has worked out. Any suggestions what to do to lock it in place?
  5. On a different note, is it possible to add a Function snippet into the code I posted in order to resize the Image without screwing up the pixels on a 'large' scale? Currently I'm just limiting the picture within the border using height=x and width=x in the <img src> tag, which compresses the pixels quite a lot
  6. I added the enctype tag and it's working properly now, thanks a lot. I honestly didn't even know what that was!
  7. Form tag: echo '<form action="andra.php?uid='.$_SESSION['SESS_MEMBER_ID'].'&send=true" method="post">'; PHPInfo(): [b]file_uploads:[/b] On [b]post_max_size:[/b] 128M
  8. After adding your debug line, this is what I get Array ( ) Invalid file
  9. echo '<strong>Profil-Bild:</strong> <input type="file" name="profilepic"> '; This is the Input line, I've overlooked the other ~10+ input tags and they're all ok as well, I also tried debugging but it always goes back to 'Invalid File'.
  10. Hi. I've got an issue with a simple File (Image) Upload Script, it's the following: $allowedExts = array("jpg", "jpeg", "gif", "png"); $extension = end(explode(".", $_FILES["profilepic"]["name"])); if ((($_FILES["profilepic"]["type"] == "image/gif") || ($_FILES["profilepic"]["type"] == "image/jpeg") || ($_FILES["profilepic"]["type"] == "image/png") || ($_FILES["profilepic"]["type"] == "image/pjpeg")) && ($_FILES["profilepic"]["size"] < 2000000000) && in_array($extension, $allowedExts)) { if ($_FILES["profilepic"]["error"] > 0) { echo "Return Code: " . $_FILES["profilepic"]["error"] . "<br>"; } else { echo "Upload: " . $_FILES["profilepic"]["name"] . "<br>"; echo "Type: " . $_FILES["profilepic"]["type"] . "<br>"; echo "Size: " . ($_FILES["profilepic"]["size"] / 1024) . " kB<br>"; echo "Temp file: " . $_FILES["profilepic"]["tmp_name"] . "<br>"; $dir = "images/profilepics/". $_SESSION['SESS_MEMBER_ID']; if(!is_dir($dir)){ mkdir($dir); } move_uploaded_file($_FILES["profilepic"]["tmp_name"], $dir . "/profile.png"); $newpicpath = $dir . "/profile.png"; } } else { echo "Invalid file"; } Now the actual issue at hand is the following: I've got 1 Live-Test Script and one not-Live Script to test this on, and the problem is, the script itself (Creating the Dir, Moving the Image) only works on the Non-Live Script (Test2.php). However, using the EXACT same code snippet from the Non-Live Script(Test2.php) in the Live Script (ModifyProfile.php), it returns with "Invalid file", regardless of using the same image on both the PHP's. Anyone got a clue as to why this is?
  11. Wow I can't believe I didn't see that.. Sorry! And thanks for the help.
  12. Hey. I've got an issue with my script. The Data is pulled from the database, but for some reason the printed Data skips 1 Row, which is not what it's supposed to do. It pulls the rest of them quite successfully, but the fact that it skips 1 ruins the whole point of the script. Here's a picture of the Database Table Data, currently: http://i45.tinypic.com/2hdw1sx.png Here's a picture of the Printed Data on the website: http://i49.tinypic.com/2ylkcj6.png And here's the code if($_SESSION['SESS_MEMBER_ID'] == $data['uid']) { $sql = "SELECT * FROM grannar where uid='".$data['uid']."' ORDER BY targetname"; $query = mysql_query( $sql ); $rows = mysql_nuM_rows( $query ); $data = NULL; echo '<div class="sidebar" id="sideRight3">'; echo '<div class="sidebar" id="sideRight4">'; echo '<strong><center> - Mina Grannar -</center></strong>'; echo '</div>'; if($rows == 0) { echo 'Du har tyvärr inga grannar ännu.'; } if($query) { $row = mysql_fetch_array($query); $table_start = "<table border='0' style='color: #8e0046;'> <tr> </tr>"; $table_end = "</table>"; while($row = mysql_fetch_array($query)) { $data .= "<tr>"; $data .= "<td><img src='".$row['profilepic']."' width='30' height='30'>"; if($row['connected'] == "online") { $data .= "<td><img src='online.png' width='5' height='5'> <a href='profile.php?uid=".$row['targetid']."'>" . ucfirst($row['targetname']) . "</a></td>"; } else { $data .= "<td><img src='offline.png' width='5' height='5'> <a href='profile.php?uid=".$row['targetid']."'>" . ucfirst($row['targetname']) . "</a></td>"; } //echo ' <img src="'.$image.'" width="30" height="30"><a href="profile.php?uid='.$row['targetid'].'"><font size="3">'.$fname .' ' .$lastname. '</font>'; $data .= "</tr>"; } echo $table_start . $data . $table_end; echo '</div><!-- .sidebar#sideRight -->'; } } As you can see it skips 1 Row/Record of the Pulled Data, and I can't figure out why. Thanks!
×
×
  • 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.