Jump to content

gojo62

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

gojo62's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi Guys Added line of code supplied by jggretton now chrome shows blank page and IE8 shows code as shown below <html><head><title>Robin's Nest (a1)</title></head><body><font face='verdana' size='2'><h2>Robin's Nest</h2><b>a1</b>: <a href='rnmembers.php?view=a1'>Home</a> | <a href='rnmembers.php'>Members</a> | <a href='rnfriends.php'>Friends</a> | <a href='rnmessages.php'>Messages</a> | <a href='rnprofile.php'>Profile</a> | <a href='rnlogout.php'>Log out</a><h3>Edit your Profile</h3><img src='a1.jpg' border='1' align='left'/>aa<br clear=left /><br /> if I add [codeecho '<pre>' . print_r($_POST,true) . '</pre>'; echo '<pre>' . print_r($_FILES,true) . '</pre>';] I get above text on page plus this underneath <pre>Array ( [text] => aa ) </pre><pre>Array ( [image] => Array ( [name] => book.png [type] => image/png [tmp_name] => E:\UniServer\tmp\phpE267.tmp [error] => 0 => 45358 ) ) </pre><form method='post' action='rnprofile.php' enctype='multipart/form-data'> Enter or edit your details and/or upload an image:<br /> <textarea name='text' cols='40' rows='3'>aa</textarea><br /> Image: <input type='file' name='image' size='14' maxlength='32' /> <input type='submit' value='Save Profile' /> </pre></form> If I log back into robinsnest the image has successfully been altered but I guess I still have a underline problem. Gary
  2. Thanks Guys I will go and test these later. Gary
  3. The images on the server are as follows original png 600w 300h 14kb ie8 uploaded 600w 300h 14kb chrome uploaded 100w 60h 4kb So IE8 hasn't altered it at all while chrome has this also the case for all the other png's I have tried while jpegs have been made a lot small.
  4. $max = 100; $newwidth = $max / $height * $width; $newheight = $max; hope that helps Gary
  5. This code is taken from the book Learning Php Mysql & javascript. It converts an image into a thumbnail 100 by 100 and works fine in chrome but in IE8 it does not resize PNG images but saves them at original size. I have spent a day searching the internet for answers and even tried joining the books forum but had problems logging into it! If anyone knows why PNG images are not getting resized in IE8 I would be deeply grateful. <?php // rnprofile.php include_once 'rnheader.php'; if (!isset($_SESSION['user'])) die("<br /><br />You need to login to view this page"); $user = $_SESSION['user']; echo "<h3>Edit your Profile</h3>"; if (isset($_POST['text'])) { $text = sanitizeString($_POST['text']); $text = preg_replace('/\s\s+/', ' ', $text); $query = "SELECT * FROM rnprofiles WHERE user='$user'"; if (mysql_num_rows(queryMysql($query))) { queryMysql("UPDATE rnprofiles SET text='$text' where user='$user'"); } else { $query = "INSERT INTO rnprofiles VALUES('$user', '$text')"; queryMysql($query); } } else { $query = "SELECT * FROM rnprofiles WHERE user='$user'"; $result = queryMysql($query); if (mysql_num_rows($result)) { $row = mysql_fetch_row($result); $text = stripslashes($row[1]); } else $text = ""; } $text = stripslashes(preg_replace('/\s\s+/', ' ', $text)); if (isset($_FILES['image']['name'])) { $saveto = "$user.jpg"; move_uploaded_file($_FILES['image']['tmp_name'], $saveto); $typeok = TRUE; switch($_FILES['image']['type']) { case "image/gif": $src = imagecreatefromgif($saveto); break; case "image/jpeg": // Both regular and progressive jpegs case "image/pjpeg": $src = imagecreatefromjpeg($saveto); break; case "image/png": $src = imagecreatefrompng($saveto); break; default: $typeok = FALSE; break; } if ($typeok) { list($w, $h) = getimagesize($saveto); $max = 100; $tw = $w; $th = $h; if ($w > $h && $max < $w) { $th = $max / $w * $h; $tw = $max; } elseif ($h > $w && $max < $h) { $tw = $max / $h * $w; $th = $max; } elseif ($max < $w) { $tw = $th = $max; } $tmp = imagecreatetruecolor($tw, $th)or die('Cannot Initialize new GD image stream'); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $tw, $th, $w, $h); imageconvolution($tmp, array( // Sharpen image array(-1, -1, -1), array(-1, 16, -1), array(-1, -1, -1) ), 8, 0); imagejpeg($tmp, $saveto); imagedestroy($tmp); imagedestroy($src); } } showProfile($user); echo <<<_END <form method='post' action='rnprofile.php' enctype='multipart/form-data'> Enter or edit your details and/or upload an image:<br /> <textarea name='text' cols='40' rows='3'>$text</textarea><br /> Image: <input type='file' name='image' size='14' maxlength='32' /> <input type='submit' value='Save Profile' /> </pre></form> _END; ?> Thanks Gary
×
×
  • 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.