How can you add Images onto a web site

  • finland
  • Newbie
  • Newbie
  • finland
  • Posts: 7

Post 3+ Months Ago

How can you add Images onto a web site

and set a limited of the images that can be sent

thanks
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • sin0cide
  • Born
  • Born
  • sin0cide
  • Posts: 3

Post 3+ Months Ago

well the img code would give you images onto your own webpage... I.E.
Code: [ Select ]
<img src="location of file" alt="title" height="150px" width="150px">


but if you looking at adding them to you a forum or blogs that is a whole different story. and why would you want a limit that can be sent?

are you trying to make a page that anyone can add images too?
  • finland
  • Newbie
  • Newbie
  • finland
  • Posts: 7

Post 3+ Months Ago

i want people to send me photo images from my website, via a web form, dont want images to be over 5mbs
  • sin0cide
  • Born
  • Born
  • sin0cide
  • Posts: 3

Post 3+ Months Ago

you will need a coding back end but this php setup is probably what your looking for.
http://www.phpfreaks.com/tutorials/36/0.php
  • finland
  • Newbie
  • Newbie
  • finland
  • Posts: 7

Post 3+ Months Ago

thanks for the link

i dont understand a word of PHP

lol
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8388
  • Loc: USA

Post 3+ Months Ago

Code: [ Select ]
<?php
if (($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg")
|| ($_FILES["file"]["type"] == "image/bmp")
&& ($_FILES["file"]["size"] < 6))
 {
 if ($_FILES["file"]["error"] > 0)
  {
  echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
  }
 else
  {
  echo "Upload: " . $_FILES["file"]["name"] . "<br />";
  echo "Type: " . $_FILES["file"]["type"] . "<br />";
  echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
  echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

  if (file_exists("upload/" . $_FILES["file"]["name"]))
   {
   echo $_FILES["file"]["name"] . " already exists. ";
   }
  else
   {
   move_uploaded_file($_FILES["file"]["tmp_name"],
   "upload/" . $_FILES["file"]["name"]);
   echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
   }
  }
 }
else
 {
 echo "Invalid file";
 }
?>
<form method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>
  1. <?php
  2. if (($_FILES["file"]["type"] == "image/gif")
  3. || ($_FILES["file"]["type"] == "image/jpeg")
  4. || ($_FILES["file"]["type"] == "image/pjpeg")
  5. || ($_FILES["file"]["type"] == "image/bmp")
  6. && ($_FILES["file"]["size"] < 6))
  7.  {
  8.  if ($_FILES["file"]["error"] > 0)
  9.   {
  10.   echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
  11.   }
  12.  else
  13.   {
  14.   echo "Upload: " . $_FILES["file"]["name"] . "<br />";
  15.   echo "Type: " . $_FILES["file"]["type"] . "<br />";
  16.   echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
  17.   echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
  18.   if (file_exists("upload/" . $_FILES["file"]["name"]))
  19.    {
  20.    echo $_FILES["file"]["name"] . " already exists. ";
  21.    }
  22.   else
  23.    {
  24.    move_uploaded_file($_FILES["file"]["tmp_name"],
  25.    "upload/" . $_FILES["file"]["name"]);
  26.    echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
  27.    }
  28.   }
  29.  }
  30. else
  31.  {
  32.  echo "Invalid file";
  33.  }
  34. ?>
  35. <form method="post"
  36. enctype="multipart/form-data">
  37. <label for="file">Filename:</label>
  38. <input type="file" name="file" id="file" />
  39. <br />
  40. <input type="submit" name="submit" value="Submit" />
  41. </form>


That's just the include script. You'd have to implement that into an email form. When I have the time, I could make you a script like that. I think I would be able to do that (a nice thing to do since I'm learning PHP right now :) ).
  • finland
  • Newbie
  • Newbie
  • finland
  • Posts: 7

Post 3+ Months Ago

still cant get it working, to send pics.......

Here is the php code I'm using

PHP:
PHP Code: [ Select ]
 
<?php
 
if(isset($_POST['submit']))  {
 
 
 
        $to  =  "email goes here";
 
        $subject  =  "Customer  Email  -  YOUR  WEBSITE.com";
 
        $name_field  =  $_POST['name'];
 
        $email_field  =  $_POST['email'];
 
        $message  =  $_POST['message'];
 
 
 
        $body  =  "Customer  Email  From  YOURSITE.com,\n  \n  Contact  Information:  \n  From:  $name_field\n  Customer  E-Mail  Address:  $email_field\n  ustomer  Message:\n  \n  $message\n  \n  End  Message";
 
 
 
        echo  "Data  has  been  submitted  to  web site goes here!  <a  href='Test_email.html'>Go  Back  To  Contact  Page</a>";
 
        mail($to,  $subject,  $body);
 
       
 
}  else  {
 
        echo  "Error  Sending  Message!";
 
}
 
?>
  1.  
  2. <?php
  3.  
  4. if(isset($_POST['submit']))  {
  5.  
  6.  
  7.  
  8.         $to  =  "email goes here";
  9.  
  10.         $subject  =  "Customer  Email  -  YOUR  WEBSITE.com";
  11.  
  12.         $name_field  =  $_POST['name'];
  13.  
  14.         $email_field  =  $_POST['email'];
  15.  
  16.         $message  =  $_POST['message'];
  17.  
  18.  
  19.  
  20.         $body  =  "Customer  Email  From  YOURSITE.com,\n  \n  Contact  Information:  \n  From:  $name_field\n  Customer  E-Mail  Address:  $email_field\n  ustomer  Message:\n  \n  $message\n  \n  End  Message";
  21.  
  22.  
  23.  
  24.         echo  "Data  has  been  submitted  to  web site goes here!  <a  href='Test_email.html'>Go  Back  To  Contact  Page</a>";
  25.  
  26.         mail($to,  $subject,  $body);
  27.  
  28.        
  29.  
  30. }  else  {
  31.  
  32.         echo  "Error  Sending  Message!";
  33.  
  34. }
  35.  
  36. ?>


NOW THE HTML


Code: [ Select ]
<body>

<form action="mailer.php" method="POST" enctype="multipart/form-data"> 

Email Us From Your Browser --

  <p></p>

  Name:

  <input type="text" name="name" size="19"><br>

  <br>

  E-Mail:

  <input type="text" name="email" size="19"><br>

  <br>

 

  <br>

Message:<br>

  <textarea rows="9" name="message" cols="30"></textarea>
  <br />
  <br />
  <label>image
  <input type="file" name="file" />
  </label>
  <br>

  <br>

  <input type="submit" value="Submit" name="submit">

</form>
  1. <body>
  2. <form action="mailer.php" method="POST" enctype="multipart/form-data"> 
  3. Email Us From Your Browser --
  4.   <p></p>
  5.   Name:
  6.   <input type="text" name="name" size="19"><br>
  7.   <br>
  8.   E-Mail:
  9.   <input type="text" name="email" size="19"><br>
  10.   <br>
  11.  
  12.   <br>
  13. Message:<br>
  14.   <textarea rows="9" name="message" cols="30"></textarea>
  15.   <br />
  16.   <br />
  17.   <label>image
  18.   <input type="file" name="file" />
  19.   </label>
  20.   <br>
  21.   <br>
  22.   <input type="submit" value="Submit" name="submit">
  23. </form>
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Posts: 6230
  • Loc: South-Africa

Post 3+ Months Ago

Maybe just add code tags in posts to make it easier to read by using around the code
  • finland
  • Newbie
  • Newbie
  • finland
  • Posts: 7

Post 3+ Months Ago

[ok]
  • martens
  • Beginner
  • Beginner
  • martens
  • Posts: 41

Post 3+ Months Ago

It should help?
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Posts: 6230
  • Loc: South-Africa

Post 3+ Months Ago

martens wrote:
It should help?

What?
  • finland
  • Newbie
  • Newbie
  • finland
  • Posts: 7

Post 3+ Months Ago

i still cant get images to come in an from:(
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8388
  • Loc: USA

Post 3+ Months Ago

Do you want it to be like an Image mail where YOU send the people or where people send it to you?

You could have it that they upload the image to a directory at the same time that they send you the form and you get the url of the image that they submitted and you would be able to see it then... that would be easy to do if you have the scripts for mail and for uploading... just combine them and have the URL be sent to you as the user presses submit of the mail...
  • sectio
  • Newbie
  • Newbie
  • sectio
  • Posts: 6

Post 3+ Months Ago

i think u should just make a chatango account, copy image location and shows image on chat box real simple. or use the <img src="-----------"> tag
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Posts: 6230
  • Loc: South-Africa

Post 3+ Months Ago

here is a full on explanation from W3C which gives source code and a proper explanation ... http://www.w3schools.com/php/php_file_upload.asp

Post Information

  • Total Posts in this topic: 15 posts
  • Users browsing this forum: No registered users and 28 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.