Help - Search - Members - Calendar
Full Version: Fatal Error
Zymic Webmaster Forums > Zymic Free Web Hosting > Zymic Free Web Hosting - General Discussion & Help
RedBOX
CODE
atal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 12032 bytes) in /www/99k.org/i/m/g/imgupload/htdocs/basic.php on line 85
EMOruffino
QUOTE(RedBOX @ Oct 25 2007, 12:39 PM) *
CODE
atal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 12032 bytes) in /www/99k.org/i/m/g/imgupload/htdocs/basic.php on line 85

this sounds like the setting in the php wont allow that size of uploads, is this for a script? in most cases the files is usually named (inc.php) and is usually set for 8mb upload.

for my knowledge, please post a little more info wink.gif
RedBOX
My script
The file was only 2.83MB
Ed
Either a script on zymic host has been extremely greedy with memory, or your script is at fault and using a lot of memory. Paste the script and we can tell you which one it is.
EMOruffino
QUOTE(RedBOX @ Oct 25 2007, 12:59 PM) *
My script
The file was only 2.83MB


like bread said, post the script so we can see
RedBOX
CODE
<?
require "include/functions.php";
$title2 = "Upload";
include("header.php");
$sesusername = $_COOKIE['imgu_username'];
$uid = $_COOKIE['imgu_uid'];
$leftsize = 0;
$sizeleft2 = 0;
if (!isset($HTTP_POST_FILES['userfile'])) exit;

if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) {
    $filesize = $HTTP_POST_FILES['userfile']['size'];
    if ($HTTP_POST_FILES['userfile']['size']>$max_size) {
        echo "<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">File Size too Big!</font><br>\n"; exit; }

        if ($HTTP_POST_FILES['userfile']['type']=="image/gif") {
            $type = ".gif";
        }

        if ($HTTP_POST_FILES['userfile']['type']=="image/pjpeg") {
            $type = ".jpg";
        }

        if ($HTTP_POST_FILES['userfile']['type']=="image/jpeg") {
            $type = ".jpeg";
        }

        if ($HTTP_POST_FILES['userfile']['type']=="image/png") {
            $type = ".png";
        }
        /*
        if ($HTTP_POST_FILES['userfile']['type']=="application/x-shockwave-flash") {
        $type = ".swf";
        $tnFileUrl = "http://imgupload.eu/image/swf.png";
        }

        if ($HTTP_POST_FILES['userfile']['type']=="image/bmp") {
        $type = ".bmp";
        }

        if ($HTTP_POST_FILES['userfile']['type']=="application/pdf") {
        $type = ".pdf";
        $tnFileUrl = "http://imgupload.eu/image/pdf.png";
        }

        if ($HTTP_POST_FILES['userfile']['type']=="application/x-compressed") {
        $type = ".zip";
        $tnFileUrl = "http://imgupload.eu/image/zip.png";
        }


        if (file_exists("./".$path . $HTTP_POST_FILES['userfile']['name'])) {
        echo "<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">A File with that name exists, please rename your file.</font><br>\n"; exit; }
        */
        //SQL stuff
        list($width, $height, $attr) = array_values(getimagesize($HTTP_POST_FILES['userfile']['tmp_name']));
        $added = sqlesc(get_date_time());
        if($loggedin){
            mysql_query("INSERT INTO img (username, uid, size, width, height, type, date) VALUES('$sesusername', '$uid', '$filesize', '$width', '$height', '$type', $added)") or sqlerr(__FILE__, __LINE__);
        } else {
            mysql_query("INSERT INTO img (size, width, height, type, date) VALUES($filesize, $width, $height, '$type', $added)") or sqlerr(__FILE__, __LINE__);;
        }
        $id = mysql_insert_id();
        $zufall = "$id";
        //$zufall = rand(1,9999999999);
        $fupl = "$zufall";

        $res = copy($HTTP_POST_FILES['userfile']['tmp_name'], "./".$path .$fupl .$type);

        if (!$res) { echo "<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">Upload Failed, please try again</font><br>\n"; exit; } else {

            print ("<br>");

            //set url variable
            $domst = "";
            $drecks = "/";
            $imgf = $fupl .$type;
            $thbf = $tpath.$imgf;
            $urlf = $domst .$domain .$drecks .$path .$imgf;

            //create thumbnails
            function createthumb($name,$filename,$new_w,$new_h){
                $system=explode('.',$name);
                if (preg_match('/jpg|jpeg|JPG/',$system[1])){
                    $src_img=imagecreatefromjpeg($name);
                }
                if (preg_match('/png|PNG/',$system[1])){
                    $src_img=imagecreatefrompng($name);
                }
                if (preg_match('/gif|GIF/',$system[1])){
                    $src_img=imagecreatefromgif($name);
                }


                $old_x=imageSX($src_img);
                $old_y=imageSY($src_img);
                if ($old_x > $old_y) {
                    $thumb_w=$new_w;
                    $thumb_h=$old_y*($new_h/$old_x);
                }
                if ($old_x < $old_y) {
                    $thumb_w=$old_x*($new_w/$old_y);
                    $thumb_h=$new_h;
                }
                if ($old_x == $old_y) {
                    $thumb_w=$new_w;
                    $thumb_h=$new_h;
                }

                $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);
                imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);


                if (preg_match("/png/",$system[1]))
                {
                    imagepng($dst_img,$filename);
                }
                if (preg_match("/gif/",$system[1]))
                {
                    imagegif($dst_img,$filename);
                }
                else {
                    imagejpeg($dst_img,$filename);
                }
                imagedestroy($dst_img);
                imagedestroy($src_img);
            }

            createthumb($path.$imgf,$tpath.$imgf,$tsize,$tsize);
            write_log("Image $id was uploaded");
            if ($loggedin) {
                        $sqls = mysql_query("SELECT * FROM users WHERE username='$sesusername'") or sqlerr(__FILE__, __LINE__);
            $user_info = mysql_fetch_assoc($sqls) or sqlerr(__FILE__, __LINE__);
            $leftsize = $user_info[size];
            $images = $user_info[images];
            $images++;
            if ($leftsize <= 0) {
                die ("You don't have enought disk space to upload this picture. You can buy space from <a href=\"buy.php\">here</a> or <a href=\"deleteimage.php\">delete</a> old pictures."); }
                $sizeleft = $leftsize - $filesize;
                mysql_query("UPDATE users SET size='$sizeleft', images='$images' WHERE id='$user_info[id]'") or sqlerr(__FILE__, __LINE__);} else{ echo'';}
?><div id="content_container">
        <div class="content">
        
            <p class="item_top">Code for image <?=$imgf;?></p>

<a href="<? echo $domst .$domain .$drecks ?>viewer.php?id=<? echo $imgf; ?>"><b>See</b></a> the image.
Please don't change any codes while linking!
<br>
Please use clickable thumbnail codes (they save ImgUpload's bandwidth):
    <input name="thetext" type="text" id="thetext" style="width: 500px;" onClick="highlight(this);" value="&lt;a href=<? echo $domst .$domain .$drecks; ?>viewer.php?id=<? echo $imgf; ?>&gt;&lt;img src=<? echo $domst.$domain.$drecks.$tpath.$imgf; ?>&gt;&lt;/a&gt;" size="70">
Thumbnail for Websites <br>
    <input name="thetext" type="text" id="thetext" style="width: 500px;" onClick="highlight(this);" value="[URL=<? echo $domst .$domain .$drecks; ?>viewer.php?id=<? echo $imgf; ?>][IMG]<? echo $domst.$domain.$drecks.$tpath.$imgf; ?>[/IMG][/URL]" size="70">
Thumbnail for forum(1)<br>
    <input name="thetext" type="text" id="thetext" style="width: 500px;" onClick="highlight(this);" value="[url=<? echo $domst .$domain .$drecks; ?>viewer.php?id=<? echo $imgf; ?>][img]<? echo $domst.$domain.$drecks.$tpath.$imgf; ?>[/img][/url]" size="70">
Thumbnail for forum(2)<br>
    <input onClick="highlight(this);" style="width: 300px;" size="70" value="Thanks to ImgUpload for [URL=http://ImgUpload.eu]Free Image Hosting[/URL]" type="text">
Link back to ImgUpload or use the <a href="links.php"><b>banners and buttons</b></a>.

<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
<br>
<a href='viewer.php?id=<? echo $imgf; ?>'><img src='<? echo $thbf ?>' border="0"></a>
</td>
</tr>
</tbody>
</table>
    <br>
        <input name="thetext" type="text" id="thetext" style="width: 500px;" onClick="highlight(this);" value="[URL=http://ImgUpload.eu][IMG]<? echo $urlf; ?>[/IMG][/URL]" size="70">
Hotlink for forums (1)
    <br>
        <input name="thetext" type="text" id="thetext" style="width: 500px;" onClick="highlight(this);" value="[url=http://ImgUpload.eu][img]<? echo $urlf; ?>[/img][/url]" size="70">
    Hotlink for forums (2)
    <br>
        <input name="thetext" type="text" id="thetext" style="width: 500px;" onClick="highlight(this);" value="&lt;a href=&quot;http://ImgUpload.eu&quot;&gt;&lt;img src=&quot;<? echo $urlf; ?>&quot; border=&quot;0&quot; alt=&quot;Image Hosted by ImgUpload.NET&quot; /&gt;&lt;/a&gt;" size="70">
    Hotlink for Websites
    <br>
        <input name="thetext" type="text" id="thetext" style="width: 500px;" onClick="highlight(this);" value="<? echo $domst .$domain .$drecks ?>viewer.php?id=<? echo $imgf; ?>" size="70">
    <a href="<? echo $domst .$domain .$drecks ?>viewer.php?id=<? echo $imgf; ?>"><b>Show</b></a> image to friends<br>
    <input name="thetext" type="text" id="thetext" style="width: 500px;" onClick="highlight(this);" value="<? echo $urlf; ?>" size="70">
    Direct link to image
    <br>
    <br>


            
        </div>
<? include("footer.php");

        }
} else { echo "<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">Sorry we don't allow that file type.!</font><br>\n"; exit; }

?>
Ed
Nothing obvious that suggests it's your script. If you're not aware, you share resources with everyone else hosted on the server, so if someone is using more than their fair amount you will be effected.
RedBOX
I know i share one host but how to make it upload a little bigger files like 2mb?
RedBOX
I tried to upload almost every hour but it gives me that error...
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.