Jump to content

avario

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

avario's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am trying to set up a sort of instant messaging system on a site I am creating. Users submit their messages which are then stored in a database. Other users looking at the page should then be able to see this message as soon as possible. The only way I can make this work is using Ajax to send a request to search for any new messages every 2 seconds or so. Is there a better way of doing this? I just don't think this is very good as for the user's Internet usage and it is barely instant. Thanks if anyone has any ideas...
  2. I am creating a design for a Forum Website (school project). I have created this design for a post: But I don't want the post content to be centred in the midle (or top/bottom), I want the middle section (which is a separate div) to stretch out to fill the table cell such as in this image (I have just inserted breaks to show you what I mean): Does anyone no how to do this? Please let me know if you need more information such as source codes...
  3. I cant see the image link but it is probably just the page margins (by default I think it is 10px) which would stop the div stretching right across the page. If you are using Dreamweaver just go into Page Properties and set the margins to 0px. Or put this: <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } --> </style> In your page head.
  4. Thanks guys, it seems to be working without the extra bracket. The commas don't seem to be a problem though.
  5. So I have this script, but when I try to execute it the page comes at blank. So I guess there is something wrong with the syntax, right? Here is the script: for ($x = 1; $x <= ($numrows + 20 - (20 * $pageNum)); $x++){ echo ' <tr> <td><center><img src="Photos/', $gallery,'/Thumbnails/', (1 + (($pageNum - 1) * 20))), '.jpg" class="thumbnail"></center></td>'; for ($c = 2; $c <= 4; $c++){ echo ' <td><center><img src="Photos/', $gallery,'/Thumbnails/', ($c + (($pageNum - 1) * 20))), '.jpg" alt="" width="150" height="150" class="thumbnail"></center></td>'; } echo ' </tr>'; if ($x >= 4){ break; } } Can someone please tell me what is wrong with it. I would really appreciate some help. Thanks.
  6. Maybe I am just really stupid but isn't this: $result=mysqli_query($query); meant to be written like this: $result=mysql_query($query); without the i? Or is that just something different?
  7. Thank you so much Boom.dk. The script is just what I was looking for and worked perfectly. Thank you.
  8. I have a script that uploads an image using a form. It creates a preview version of image (width of 500px) and a thumbnail version of the image (width of 100px). But I want all of the thumbnails created be the script to be square, but not distorted, so I need to scale the image so that it maximum dimension is 100 (which I can do) but then I need to crop the other dimension to 100 to make it square (which I can't do). mean? Does anyone know a script that I can add to my upload script that will crop the image? Any help is much appreciated, Thanks. This is my upload script if it helps: $imagename = $_FILES['new_image']['name']; $source = $_FILES['new_image']['tmp_name']; $target = "Images/Photos/".$imagename; move_uploaded_file($source, $target); $imagepath = $imagename; $save = "Images/Photos/Previews/" . $imagepath; //This is the new file you saving $file = "Images/Photos/" . $imagepath; //This is the original file list($width, $height) = getimagesize($file) ; $modwidth = 500; $diff = $width / $modwidth; $modheight = $height / $diff; $tn = imagecreatetruecolor($modwidth, $modheight) ; $image = imagecreatefromjpeg($file) ; imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; imagejpeg($tn, $save, 100) ; $save = "Images/Photos/Thumbnails/" . $imagepath; //This is the new file you saving $file = "Images/Photos/" . $imagepath; //This is the original file list($width, $height) = getimagesize($file) ; $modwidth = 100; $diff = $width / $modwidth; $modheight = $height / $diff; $tn = imagecreatetruecolor($modwidth, $modheight) ; $image = imagecreatefromjpeg($file) ; imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; imagejpeg($tn, $save, 100) ;
  9. Thanks for the reply. I think I will just call each image a unique number to avoid the problem.
  10. I have made a form that uploads images to a directory that I specify. But does anyone know what will happen if the image being uploaded has the same name as one that has previously been uploaded? Will it replace the previous image, not upload or upload using a different name? It would be very helpful if someone could tell me, 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.