Topic: attach image

I've done a search and have only found the 'very involved' attachment mod.  I was wondering if there was a mod that simply allowed users to upload an image to a specified directory on my server and then they can just link to that.  I would only want to host images... no videos or anything.

Thanks.

2

Re: attach image

That would be a nice mod, then the board could be used for classified ads and such.

Re: attach image

i dunno if there is one or not but maybe a file type management type thing (like the phpbb attachment mod has) could be added to the punbb attachent mod to make that useful for you as writing a new mod to do a similar task seems pointless

Re: attach image

Well, modify the attachment mod for that, I would say no, better integrate a gallery or something I would say. IIRC there was someone doing it.

(IIRC = If I Recall Correctly)

Re: attach image

well coppermine users can be integrated but it would be nice to see a proper punbb photo gallery (proper as in up to the same standards of code, speed usability etc)

Re: attach image

Punbb integration was just released as part of standard package of Coppermine 1.3.2.  I'm running it on my site although not many have been using it because of my image upload mod! big_smile

Digital photography news, reviews, discussions and more!
http://www.shuttertalk.com

The online bible for all
http://www.publicbible.com

Re: attach image

sweet, I'll take a look at coppermine! 

Did you make your image upload mod or is there somewhere i can find that, cuteseal? I tried it out..... Thats exactly what i want to do!

thanks!

Re: attach image

I wrote it... although I'm not keen to release it coz it's very ugly!! sad

Digital photography news, reviews, discussions and more!
http://www.shuttertalk.com

The online bible for all
http://www.publicbible.com

Re: attach image

cuteseal wrote:

I wrote it... although I'm not keen to release it coz it's very ugly!! sad

sad okay ... im sure its better than i could do, b/c im only a novice html'er. 

Anyone else able to duplicate thie mod?  I'm not sure i want somethign even as fancy as the coppermine gallery... this is all i want.....

thx

10 (edited by Connorhd 2004-08-27 15:36)

Re: attach image

what if you just get a phpupload script that let users uplaod and gave them a link that they could then post in a forum?

Re: attach image

Ok... here it is... don't scream! big_smile

http://www.shuttertalk.com/upload.zip

I basically made chmodded one directory to 777 and dropped this script in it.  The script uploads to that directory. 

There's a bit of javascript at the end which pastes the code back into the message box via the window's opener, which assumes that the upload script was opened as a popup from the message box window.

There's lots of stuff hardcoded everywhere, so test it out before releasing it to your public!

Digital photography news, reviews, discussions and more!
http://www.shuttertalk.com

The online bible for all
http://www.publicbible.com

12

Re: attach image

maybe add something like

require 'config.php';
require 'include/common.php';
...
if ($cookie['is_guest']) message($lang_common['No permission']);

?

13 (edited by jchristophm 2004-10-05 04:17)

Re: attach image

I just started with punBB, and I like it quite a bit so far. I'm not that much of a PHP programmer, but I can figure this out. Image upload is very important to me.

I took cuteseal's upload.php, dropped it in a 777 directory, modified it a bit, and then added the following javascript code in post.php at line 472:

<script type="text/javascript">
   function open_win()
   {
      window.open("http://www.ilovephysics.com/forum/images/upload/upload.php","my_new_window","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=450, height=150")
   }
</script>
<form>
   <input type="button" value="Upload Image" onclick="open_win()">
</form>

Worked like a charm smile although I'm sure there is a more elegant way of doing this.

Do you love physics? :) http://www.ilovephysics.com
Interested in Internet Marketing? http://www.keyliberty.com

Re: attach image

Glad you like it smile

Digital photography news, reviews, discussions and more!
http://www.shuttertalk.com

The online bible for all
http://www.publicbible.com

Re: attach image

i have a problen with this mod.
i used this code

<script type="text/javascript">
   function open_win()
   {
      window.open("http://www.ilovephysics.com/forum/images/upload/upload.php","my_new_window","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=450, height=150")
   }
</script>
<form>
   <input type="button" value="Upload Image" onclick="open_win()">
</form>

and when the popup open apper this error

$URL = "http://xxxxxx/xxx/xxx/upload/"; $maxsize = 153600

and then apper the normal webpage.

what can i do to resolve this error plz help me.

El Mejor Lugar de la Red - Corporación Azakur4

Re: attach image

Well first you have my URL in the window.open function. But even still, you have to change some things in the upload.php that cuteseal posted. The first two lines are:

$URL = "http://www.ilovephysics.com/forum/images/upload/";
$maxsize = 153600

You have to move these lines after the first <?php and add a semicolon after 153600. Here is the upload.php that I have:

<html>
        <head>
            <title>ilovephysics.com :: Forums - image upload</title>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
            <meta name="keywords" content="physics, math, science">
            <meta name="description" content="A community of Physics Phans!">

            <title>Shuttertalk Forums / Help</title>
            <link rel="stylesheet" type="text/css" href="../../style/Oxygen.css">
        </head>
        
        <body>
<table align="center" cellpadding="10">
  <td bgcolor="#FFFFFF"> 
      <?php

    $URL = "http://www.ilovephysics.com/forum/images/upload/";
    $maxsize = 153600;
    
if (isset($_POST['upload'])) 
{
    //Check first if a file has been selected
    $fileonserver = stripslashes($_FILES['uploaded']['name']);
    $tmpfile = stripslashes($_FILES['uploaded']['tmp_name']);
    while (file_exists($fileonserver))
    {
        $rand = rand(0, 99);
        $file_name = $rand."_".$fileonserver;
        $fileonserver = $file_name;
    }

    if (is_uploaded_file($tmpfile))
    {

        if ($_FILES['uploaded']['type'] == "image/pjpeg" || $_FILES['uploaded']['type'] == "image/jpeg" || $_FILES['uploaded']['type'] == "image/png" || $_FILES['uploaded']['type'] == "image/bmp" || $_FILES['uploaded']['type'] == "image/gif")
        { 

            //Get the Size of the File
            $size = $_FILES['uploaded']['size'];
        
            //Make sure that $size is less than 150KB
            if ($size > $maxsize)
            {
        
                //Print the error
                echo '<b>File Too Large. Please try again.</b>';
                echo '<p><a href="javascript:back()">Back</a>';
                exit();
        
            }
        
            //Move the File to the Directory of your choice
            if (move_uploaded_file($tmpfile,dirname($_SERVER['PATH_TRANSLATED']).'/'.$fileonserver)) 
            {
                //tell the user that the file has been uploaded
                echo '<center><font size="3"><b>File Uploaded!</font></center><br>URL to file is:</b><br>';
                echo $URL . rawurlencode($fileonserver);
                echo '<br><b>Cut and paste this code into message:</b><br>';
                echo '[img]'.$URL . rawurlencode($fileonserver).'[/img]';
                exit();    
            }
            else
            {
            
                //Print error
                echo '<b>Unable to move the File</b>';
                echo '<p><a href="javascript:back()">Back</a>';
                exit();
            
            }
        }
        else
        {
            //Print the error
            echo '<b>You can only upload image files. Please try again.</b>';
            echo '<p><a href="javascript:back()">Back</a>';
            exit();
        }
    }
    else
    {
    
    //Print error
    echo '<b>No File Selected</b>';
    echo '<p><a href="javascript:back()">Back</a>';

    }    
}

else {

?>
      <form action="upload.php" method="post" enctype="multipart/form-data">
        <b>Select an image file to upload (max 150KB):</b><br>
<input type="file" name="uploaded"><input type="Submit" value="Upload File">
<input type="hidden" name="upload" value="true">
</form>

<?php
}
?>


</td>
</table>
</body>
</html>

Note that I got rid of the javascript that automatically pastes the [ img ] tag in the post. I couldn't get it to work.

Do you love physics? :) http://www.ilovephysics.com
Interested in Internet Marketing? http://www.keyliberty.com

Re: attach image

apper this

No File Selected
Back

sorry, i'm noob in this and my english is very bad.

El Mejor Lugar de la Red - Corporación Azakur4

Re: attach image

a tip, you can supply the max size to the form as an hidden input, and the browser should automatically tell the use that the file is too large smile

(from the top of my head, something similar to this, might be worth etiher to check my mod or html documentaiton, there are obv some browsers ignoring this, but it should help users with correct browsers)

<input type="hidden" name="MAX_FILE_SIZE" value="123456">

Re: attach image

there is no some way to give him to permissions to upload something like

if ($cookie['is_guest']) message($lang_common['No permission']);

PD: excuse by my ingles, use the translator of google

El Mejor Lugar de la Red - Corporación Azakur4

Re: attach image

Sure. But I don't let guests post at all, so I have no prblem with that.

Do you love physics? :) http://www.ilovephysics.com
Interested in Internet Marketing? http://www.keyliberty.com

21

Re: attach image

damn doesnt work for me.. i used jchristophm's script and the upload.php.. i just get "No file selected"... WHY! smile

Most people are other people. Their thoughts are someone else's opinions, their lives a mimicry, their passions a quotation - Oscar Wilde

22 (edited by Azakur4 2004-11-01 22:34)

Re: attach image

this is my code for upload.php

<?
//set these variables-----------------------------------------------------------------
$domain = "azakur4.ath.cx/Foros";      //your domainname
$path = ".../Forums/img/upload/";   //path to your targetfolder
$path_after_domain = "img/upload/";   //path to your targetfolder for use in url
$max_size = 153600;          //maximum filesize
//------------------------------------------------------------------------------------
?>

<html>
        <head>
            <title>Azakur4 WeBSiTe :: Foros - Image Upload</title>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
            <meta name="keywords" content="physics, math, science">
            <meta name="description" content="A community of Physics Phans!">

            <title>Azakur4 Foros / Ayuda</title>
            <link rel="stylesheet" type="text/css" href="http://azakur4.ath.cx/Foros/style/Oxygen.css">
        </head>
        
        <body>
<table border="1" cellpadding="1" cellspacing="4" width="100%">
  <td bgcolor="#DEDFDF">
<?php
if (!isset($HTTP_POST_FILES['userfile'])) 
{
?>
    <form action="upload.php" method="post" enctype="multipart/form-data">
    <font color="#102945" size="2" face="Verdana, Arial, Helvetica, sans-serif"><b><center>Sistema para Subir Images / Azakur4 WeBSiTe.</center></b></font>
    <br><center><b>Select an image file to upload (max 150KB):</b><br>
    <INPUT TYPE="file" NAME="userfile">
    <INPUT TYPE="submit" VALUE="Subir">
    </center>
    </form>
    <br><br><br><font color="#333333" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>© Copyright by Azakur4.</b></font>
<?php
} else {
    //Azakur4
    if (file_exists($path . $HTTP_POST_FILES['userfile']['name'])) 
    {
          echo '<b>Existe un archivo con ese nombre. Por favor renombrelo y intentelo otra vez.</b>';
        echo '<p><a href="javascript:history.back()">Regresar</a>';
        exit();
    }

    if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name']))
    {

        if (($HTTP_POST_FILES['userfile']['type']=="image/gif") || ($HTTP_POST_FILES['userfile']['type']=="image/pjpeg") || ($HTTP_POST_FILES['userfile']['type']=="image/jpeg")) 
      { 
        
            //Make sure that $size is less than 150KB
            if ($HTTP_POST_FILES['userfile']['size']>$max_size)
            {
        
                //Print the error
                echo '<b>Archivo muy grande. Por favor intentelo otra vez.</b>';
                echo '<p><a href="javascript:history.back()">Regresar</a>';
                exit();
        
            }
        
            //Move the File to the Directory of your choice
            $res = copy($HTTP_POST_FILES['userfile']['tmp_name'], $path .$HTTP_POST_FILES['userfile']['name']);
          if (!$res) 
            {
                //Print error
                echo '<b>No se pudo subir el archivo</b>';
                echo '<p><a href="javascript:history.back()">Regresar</a>';
                exit();    
            }
            else
            {
                //tell the user that the file has been uploaded
            echo '<font color="#102945" size="2" face="Verdana, Arial, Helvetica, sans-serif"><b><center>Sistema para Subir Images / Azakur4 WeBSiTe.</center></b></font>';
                echo '<br><center><font size="2"><b>Archivo Subido!</font></center><br>';
                echo '<p><center><b><a href=\'javascript:opener.Pastecode("[img]'."http://" . $domain . "/" . $path_after_domain . $HTTP_POST_FILES['userfile']['name'].'[/img]",""); javascript:close()\'>';
            echo '<font size="2" face="Verdana, Arial, Helvetica, sans-serif">[Pegar Imagen al Mensaje]</font></a></b></center>';
            echo '<br><font color="#333333" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>© Copyright by Azakur4.</b></font>';
                exit();
            }
        }
        else
        {
            //Print the error
            echo '<b>Solamente puedes subir imagenes. Por favor intentelo otra vez.</b>';
            echo '<p><a href="javascript:history.back()">Regresar</a>';
            exit();
        }
    }
    else
    {
    
    //Print error
    echo '<b>No hay archivo seleccionado</b>';
    echo '<p><a href="javascript:history.back()">Regresar</a>';

    }    

}
?>
</td>
</table>
</body>
</html>

you already modify it to your pleasure

PD: Sorry for my english is very bad sad i speak spanish tongue

El Mejor Lugar de la Red - Corporación Azakur4

Re: attach image

Hi all,

If you're using this script, I found a beautiful little script which you can drop into the image directory, and it'll let you browse the images.  Just change the title in the script.

I've modified it slightly so that (1) it has paging (2) displays images in descending date order.

http://www.shuttertalk.com/fotopholder.zip

Demo here: http://www.shuttertalk.com/forums/image … /index.php

Digital photography news, reviews, discussions and more!
http://www.shuttertalk.com

The online bible for all
http://www.publicbible.com

24

Re: attach image

I use upload.php combined with photostack:  just set the upload directory to some albums within photostack directory.

Re: attach image

Hm.. interesting - I've never seen photostack before, but it looks pretty neat.

Anyway, I was looking for a really simple script with minimal setup, fuss and configuration.  That's what fotopholder was - just ONE script which you drop into a directory of images and voila! smile

I like it because it does thumbnail generation on the fly and doesn't store any data files etc. (well it does have a thumbnail cache, but can be disabled)

Digital photography news, reviews, discussions and more!
http://www.shuttertalk.com

The online bible for all
http://www.publicbible.com