bernardmoes
Members-
Posts
13 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
bernardmoes's Achievements
Newbie (1/5)
0
Reputation
-
use divs and use this script to hide divs and show divs: <html> <head> <style type = "text/css"> .hide { display: none; } </style> <script type="text/javascript"> function switchContent(obj) { obj = (!obj) ? 'sub1' : obj; var contentDivs = document.getElementById('container').getElementsByTagName('div'); for (i=0; i<contentDivs.length; i++) { if (contentDivs[i].id && contentDivs[i].id.indexOf('sub') != -1) { contentDivs[i].className = 'hide'; } } document.getElementById(obj).className = ''; } </script> </head> <body> <a href = "#" onclick="switchContent('sub1');">Home</a> <a href = "#" onclick="switchContent('sub2');">guestbook</a> <a href = "#" onclick="switchContent('sub3');">photos</a> <a href = "#" onclick="switchContent('sub4');">contact</a> <div id = "container"> <div id = "sub1" align = "center"> home</div> <div id = "sub2" align = "center" class = "hide"> sub2 area</div> <div id = "sub3" align = "center" class = "hide"> sub3 area</div> <div id = "sub4" align = "center" class = "hide"> sub4 area</div> </div> </body> </html> copy and paste this code and see if you like to do it this way
-
im resizing my image too, you wanna know how? heres the class you will need: <?php class SimpleImage { var $image; var $image_type; function load($filename) { $image_info = getimagesize($filename); $this->image_type = $image_info[2]; if( $this->image_type == IMAGETYPE_JPEG ) { $this->image = imagecreatefromjpeg($filename); } elseif( $this->image_type == IMAGETYPE_GIF ) { $this->image = imagecreatefromgif($filename); } elseif( $this->image_type == IMAGETYPE_PNG ) { $this->image = imagecreatefrompng($filename); } } function save($filename, $image_type=IMAGETYPE_JPEG, $compression=75, $permissions=null) { if( $image_type == IMAGETYPE_JPEG ) { imagejpeg($this->image,$filename,$compression); } elseif( $image_type == IMAGETYPE_GIF ) { imagegif($this->image,$filename); } elseif( $image_type == IMAGETYPE_PNG ) { imagepng($this->image,$filename); } if( $permissions != null) { chmod($filename,$permissions); } } function output($image_type=IMAGETYPE_JPEG) { if( $image_type == IMAGETYPE_JPEG ) { imagejpeg($this->image); } elseif( $image_type == IMAGETYPE_GIF ) { imagegif($this->image); } elseif( $image_type == IMAGETYPE_PNG ) { imagepng($this->image); } } function getWidth() { return imagesx($this->image); } function getHeight() { return imagesy($this->image); } function resizeToHeight($height) { $ratio = $height / $this->getHeight(); $width = $this->getWidth() * $ratio; $this->resize($width,$height); } function resizeToWidth($width) { $ratio = $width / $this->getWidth(); $height = $this->getheight() * $ratio; $this->resize($width,$height); } function scale($scale) { $width = $this->getWidth() * $scale/100; $height = $this->getheight() * $scale/100; $this->resize($width,$height); } function resize($width,$height) { $new_image = imagecreatetruecolor($width, $height); imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight()); $this->image = $new_image; } } ?> save this class as simpleimage.php and i did the same thing as you did, this is my upload page: <?php session_start(); include('SimpleImage.php'); function file_extension($filename) { $path_info = pathinfo($filename); return $path_info['extension']; } $upfile = $_FILES['uploadedfile']['name']; $fille = file_extension($upfile); $gebruikers = $_SESSION['inloggen']; if($fille == "jpg") { $target_path = "uploads/" . $gebruikers . ".jpg"; } elseif($fille == "png") { $target_path = "uploads/" . $gebruikers . ".png"; } elseif($fille == "gif") { $target_path = "uploads/" . $gebruikers . ".gif"; } if(file_exists($target_path)) { unlink($target_path); } if ($fille == "jpg" || $fille == "png" || $fille == "gif") { if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The image ". basename( $_FILES['uploadedfile']['name']). " has been uploaded successfully!!"; $image = new SimpleImage(); $image->load($target_path); $image->resize(50,50); $image->save($target_path); } else { echo "Don't make the image too big to upload!!"; } } else { echo "Wrong file! use jpg, png or gif!!"; } ?> i hope this works for you. it does work for me
-
i've got a better idea, just turn your display 90 degrees and you will see my answer
-
you can modify it so it will crop
-
oww sorry i will translate the text from dutch to english in the code <?php session_start(); include('SimpleImage.php'); function file_extension($filename) { $path_info = pathinfo($filename); return $path_info['extension']; } $upfile = $_FILES['uploadedfile']['name']; $fille = file_extension($upfile); $user = $_SESSION['inloggen']; if($fille == "jpg") { $target_path = "uploads/" . $user . ".jpg"; } elseif($fille == "png") { $target_path = "uploads/" . $user . ".png"; } elseif($fille == "gif") { $target_path = "uploads/" . $user . ".gif"; } if(file_exists($target_path)) { unlink($target_path); } if ($fille == "jpg" || $fille == "png" || $fille == "gif") { if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "the image ". basename( $_FILES['uploadedfile']['name']). " has been uploaded successfully!"; $image = new SimpleImage(); $image->load($target_path); $image->resize(100,100); $image->save($target_path); } else { echo "don't make the image too large to upload!!"; } } else { echo "Wrong file! upload an image of jpg, png or gif!"; } ?> here you are maybe it helps
-
i've got an upload page also, and i did it this way: <?php session_start(); include('SimpleImage.php'); function file_extension($filename) { $path_info = pathinfo($filename); return $path_info['extension']; } $upfile = $_FILES['uploadedfile']['name']; $fille = file_extension($upfile); $gebruikers = $_SESSION['inloggen']; if($fille == "jpg") { $target_path = "uploads/" . $gebruikers . ".jpg"; } elseif($fille == "png") { $target_path = "uploads/" . $gebruikers . ".png"; } elseif($fille == "gif") { $target_path = "uploads/" . $gebruikers . ".gif"; } if(file_exists($target_path)) { unlink($target_path); } if ($fille == "jpg" || $fille == "png" || $fille == "gif") { if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "Het plaatje ". basename( $_FILES['uploadedfile']['name']). " is succesvol geupload!"; $image = new SimpleImage(); $image->load($target_path); $image->resize(100,100); $image->save($target_path); } else { echo "Don't make the image too large to upload!"; } } else { echo "Wrong file! upload a picture, jpg, png or gif!"; } ?> This was for uploading images too, i've uncluded a class here too. i used simpleimage.php to resize and save the image. I hope you can use this. just grab the shit you need out of this code
-
maybe this works: <?php class SimpleImage { var $image; var $image_type; function load($filename) { $image_info = getimagesize($filename); $this->image_type = $image_info[2]; if( $this->image_type == IMAGETYPE_JPEG ) { $this->image = imagecreatefromjpeg($filename); } elseif( $this->image_type == IMAGETYPE_GIF ) { $this->image = imagecreatefromgif($filename); } elseif( $this->image_type == IMAGETYPE_PNG ) { $this->image = imagecreatefrompng($filename); } } function save($filename, $image_type=IMAGETYPE_JPEG, $compression=75, $permissions=null) { if( $image_type == IMAGETYPE_JPEG ) { imagejpeg($this->image,$filename,$compression); } elseif( $image_type == IMAGETYPE_GIF ) { imagegif($this->image,$filename); } elseif( $image_type == IMAGETYPE_PNG ) { imagepng($this->image,$filename); } if( $permissions != null) { chmod($filename,$permissions); } } function output($image_type=IMAGETYPE_JPEG) { if( $image_type == IMAGETYPE_JPEG ) { imagejpeg($this->image); } elseif( $image_type == IMAGETYPE_GIF ) { imagegif($this->image); } elseif( $image_type == IMAGETYPE_PNG ) { imagepng($this->image); } } function getWidth() { return imagesx($this->image); } function getHeight() { return imagesy($this->image); } function resizeToHeight($height) { $ratio = $height / $this->getHeight(); $width = $this->getWidth() * $ratio; $this->resize($width,$height); } function resizeToWidth($width) { $ratio = $width / $this->getWidth(); $height = $this->getheight() * $ratio; $this->resize($width,$height); } function scale($scale) { $width = $this->getWidth() * $scale/100; $height = $this->getheight() * $scale/100; $this->resize($width,$height); } function resize($width,$height) { $new_image = imagecreatetruecolor($width, $height); imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight()); $this->image = $new_image; } } ?>
-
new page guestbook in div without reload whole website
bernardmoes replied to bernardmoes's topic in PHP Coding Help
anybody got an answer????? -
new page guestbook in div without reload whole website
bernardmoes replied to bernardmoes's topic in PHP Coding Help
anyone? -
new page guestbook in div without reload whole website
bernardmoes replied to bernardmoes's topic in PHP Coding Help
please help me because if i attach : $('#guestbookcontent').load('myPagingScript.php?page=2'); to the link it doesnt work, if i do that then it looks like this: <a href = "$('#guestbookcontent').load('index.php?page=".$volgende."');">Volgende</a> it doesnt work i have no idea how to attach that piece of code to my link please tell me how to -
new page guestbook in div without reload whole website
bernardmoes replied to bernardmoes's topic in PHP Coding Help
how can i attach that code to the next link? can you please tell me how? thank you for your reply -
new page guestbook in div without reload whole website
bernardmoes posted a topic in PHP Coding Help
i've written a code which reads Data from a database and shows it in a div here the code: <div id = "guestbookcontent"> <!-- Start guestbook div--> <?php $link = mysql_connect('localhost', 'root', ''); if (!$link) { die('Could not connect: ' . mysqlerror()); } $db_selected = mysql_select_db('gastenboek', $link); if(!db_selected) { die ('Can\'t use weblog : ' . mysqlerror()); } $result = mysql_query('SELECT * FROM guestbook ORDER BY bericht_id DESC'); if(!$result) { die('Invalid query : ' . mysql_error()); } while ($row = mysql_fetch_assoc($result)) { echo "<i>". $row["timestamp"]. "</i>, "; echo "<b>". $row["titel"] . "</b><br>"; echo $row["bericht"]; echo "<hr>"; } ?> <!-- End of guestbook div --> </div> This code reads Data from my database. now i want to show only 7 guestbook messages at once so i wanted to be able to switch pages i did this before and used this code: $aantal = mysql_num_rows($result); $perpage = 5; $page_count = ceil($aantal/$perpage); $page = (isset($_GET['page'])) ? $_GET['page'] : 1; $start = ($page * $perpage) - $perpage; $sql = "SELECT * FROM berichten ORDER BY bericht_id DESC LIMIT ".$start.",".$perpage.""; if ($page > 1) { $Previous = $page-1; echo("<tr><td align = 'left'><a href='gastenboekframe.php?page=".$Previous."'>Previous</a></td>"); } else { echo("<tr><td align = 'left'><b>Previous</b></td>"); } if ($page < ceil($aantal/$perpage)) { $Next = $page+1; echo("<td align = 'right'><a href='gastenboekframe.php?page=".$Next."'>Next</a></td></tr>"); } else { echo("<td align = 'right'><b>Next</b></td></tr>"); } but now i want to change a guestbook page without reloading the whole page. I only want the div to reload, not the whole page. thank you if you want to help me