Jump to content

Warning: fread() [function.fread]: Length parameter must be greater than 0


silver_ch

Recommended Posts

I have an error.after my provider change last saturday the server to a new server

The error reads:

Warning: fread() [function.fread]: Length parameter must be greater than 0 in /srv/www/vhosts/mprot.ch/httpdocs/admin/produkte-edit-ok.php on line 35

 

Any ideas on what would cause this?

 

The script was working before. I simply copied the script and files and imported the database 2 monats befor.

 

php make tumbnails and put in DB

 

my php

 

<?php

include("../inc/db.inc");



if (file_exists($bild)) {
  $bild_small = $bild . "_small.jpg";
  $isize = getimagesize($bild);
  if($isize['2'] == 2)
{
  $typ = "image/jpeg";
  $width = $isize['0'];
  $height = $isize['1'];
  //if($isize['0'] > $isize['1']) 
//	{
if($isize['0'] > 190)
	  exec("djpeg -pnm $bild | pnmscale -xsize 190 | pnmalias | cjpeg -smooth 1 >$bild_small");
else
$bild_small = $bild;

//}
//	  else
//	{
//	if($isize['1'] > 190)
//		  exec("djpeg -pnm $bild | pnmscale -ysize 190 | pnmalias | cjpeg -smooth 1 >$bild_small");
//	
//	else
//	$bild_small = $bild;
//
//	}

  $fsizesmall=filesize($bild_small);
  
  $bild_small_2=addslashes(fread(fopen($bild_small,"r"),$fsizesmall));

if (file_exists($bild)) {
		unlink($bild);
		}
if (file_exists($bild_small)) {
		unlink($bild_small);
		}
}
else
{
	$info = "<span class=\"text-titel\">Achtung! Sie haben keine JPEG Datei übertragen! Das Bild wurde nicht gespeichert</SPAN><BR>\n";
	$bild = "none";}
}  

$kat = mysql_query("SELECT * FROM kategorie WHERE kategorie_de = '$kategorie_de'");
if (mysql_numrows($kat) == 1)
	{
		$kategorie_de = mysql_result($kat, 0, "kategorie_de");
		$kategorie_en = mysql_result($kat, 0, "kategorie_en");
		$kategorie_fr = mysql_result($kat, 0, "kategorie_fr");
	}


if (($number == 0) || ($number == ""))
{
	$result = mysql_query("insert into produkt VALUES('$number','$produktname_de','$produktname_en','$produktname_fr','$sort_id','$artikel_nr','$kategorie_de','$kategorie_en','$kategorie_fr','$beschreibung_de','$beschreibung_en','$beschreibung_fr','$zubehoer_de','$zubehoer_en','$zubehoerfr','$masse','$gewicht','$preis_de','$preis_en','$preis_fr','$bild_small_2')");

}
else
{
	if($bild == "none")
		{
		$result = mysql_query("update produkt set number='$number',produktname_de='$produktname_de',produktname_en='$produktname_en',produktname_fr='$produktname_fr',sort_id='$sort_id',artikel_nr='$artikel_nr',kategorie_de='$kategorie_de',kategorie_en='$kategorie_en',kategorie_fr='$kategorie_fr',beschreibung_de='$beschreibung_de',beschreibung_en='$beschreibung_en',beschreibung_fr='$beschreibung_fr',zubehoer_de='$zubehoer_de',zubehoer_en='$zubehoer_en',zubehoer_fr='$zubehoerfr',masse='$masse',gewicht='$gewicht',preis_de='$preis_de',preis_en='$preis_en',preis_fr='$preis_fr' WHERE number='$number'");
		}
	else
		$result = mysql_query("update produkt set number='$number',produktname_de='$produktname_de',produktname_en='$produktname_en',produktname_fr='$produktname_fr',sort_id='$sort_id',artikel_nr='$artikel_nr',kategorie_de='$kategorie_de',kategorie_en='$kategorie_en',kategorie_fr='$kategorie_fr',beschreibung_de='$beschreibung_de',beschreibung_en='$beschreibung_en',beschreibung_fr='$beschreibung_fr',zubehoer_de='$zubehoer_de',zubehoer_en='$zubehoer_en',zubehoer_fr='$zubehoerfr',masse='$masse',gewicht='$gewicht',preis_de='$preis_de',preis_en='$preis_en',preis_fr='$preis_fr',bild='$bild_small_2' WHERE number='$number'");
}

if ($result == 0)
	fail("Der Datensatz enthþlt einen Fehler und konnte NICHT eingefŸgt werden.");




?>
<html>
<head>
<title>MG</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="daten/font.css">
<script language="JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000" link="#1F3664" vlink="#1F3664" alink="#1F3664" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="images/hintergrund.gif" onLoad="MM_preloadImages('images/hn-home-2.gif','images/hn-info-2.gif','images/hn-datenbanken-2.gif')">
<table width="890" border="0" cellspacing="0" cellpadding="0">
  <tr valign="top"> 
    <td width="50"><img src="images/transparent.gif" width="50" height="20"></td>
    <td width="160"> </td>
    <td width="680"> </td>
  </tr>
  <tr valign="top"> 
    <td width="50"> </td>
    <td colspan="2"><a href="de/home.html" target="_self"><img src="images/logo-head.gif" width="230" height="41" border="0" alt="Home"></a></td>
  </tr>
  <tr valign="top"> 
    <td width="50"> </td>
    <td colspan="2"><img src="images/linie-840.gif" width="840" height="1"></td>
  </tr>
  <tr valign="top"> 
    <td height="30"><img src="images/transparent.gif" width="50" height="30"></td>
    <td height="30"> </td>
    <td width="680"> </td>
  </tr>
  <tr valign="top"> 
    <td colspan="2"> 
      <table width="195" border="0" cellspacing="0" cellpadding="0">
        <tr valign="top"> 
          <td height="30"><img src="images/transparent.gif" width="20" height="30"></td>
          <td height="30"> </td>
        </tr>
        <tr valign="top"> 
          <td height="40" width="20"><img src="images/transparent.gif" width="20" height="40"></td>
          <td height="40" width="175"><a href="index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('HOME','','images/hn-home-2.gif',1)" target="_self"><img name="HOME" border="0" src="images/hn-home-1.gif" width="175" height="30" alt="HOME"></a></td>
        </tr>
        <tr valign="top"> 
          <td height="40" width="20"><img src="images/transparent.gif" width="20" height="40"></td>
          <td height="40" width="175"><a href="info-flowchart.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Info','','images/hn-info-2.gif',1)" target="_self"><img name="Info" border="0" src="images/hn-info-1.gif" width="175" height="30" alt="INFO'S"></a></td>
        </tr>
        <tr valign="top"> 
          <td height="40" width="20"><img src="images/transparent.gif" width="20" height="40"></td>
          <td height="40" width="175"><a href="news-liste.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Datenbanken','','images/hn-datenbanken-2.gif',1)" target="_self"><img name="Datenbanken" border="0" src="images/hn-datenbanken-1.gif" width="175" height="30" alt="DATENBANKEN"></a></td>
        </tr>
        <tr valign="top"> 
          <td height="20" width="20"><img src="images/transparent.gif" width="20" height="20"></td>
          <td height="20" width="175"> 
            <div align="right"><a href="news-liste.php" target="_self"><img src="images/un-editnews.gif" width="160" height="20" border="0" alt="Edit News"></a></div>
          </td>
        </tr>
        <tr valign="top"> 
          <td height="20" width="20"><img src="images/transparent.gif" width="20" height="20"></td>
          <td height="20" width="175"> 
            <div align="right"><a href="kategorien-liste.php" target="_self"><img src="images/un-editkategorien.gif" width="160" height="20" border="0" alt="Edit Kategorien"></a></div>
          </td>
        </tr>
        <tr valign="top">
          <td height="20" width="20"><img src="images/transparent.gif" width="20" height="20"></td>
          <td height="20" width="175">
            <div align="right"><a href="produkte-liste.php" target="_self"><img src="images/un-editprodukte.gif" width="160" height="20" border="0" alt="Edit Kategorien"></a></div>
          </td>
        </tr>
        <tr valign="top"> 
          <td height="20" width="20"><img src="images/transparent.gif" width="20" height="20"></td>
          <td height="20" width="175"> 
            <div align="right"><a href="occasionen-liste.php" target="_self"><img src="images/un-editoccasionen.gif" width="160" height="20" alt="Edit Occasionen" border="0"></a></div>
          </td>
        </tr>
        <tr valign="top">
          <td height="20"><img src="images/transparent.gif" width="20" height="20"></td>
          <td height="20"><div align="right"><a href="spezial-liste.php" target="_self"><img src="images/un-editspezialangebote.gif" alt="Edit Spezialangebot" width="160" height="20" border="0"></a></div>
          </td>
        </tr>
        <tr valign="top"> 
          <td height="20" width="20"><img src="images/transparent.gif" width="20" height="20"></td>
          <td height="20" width="175"> 
            <div align="right"><a href="pdf-liste.php" target="_self"><img src="images/un-editpdfarchiv.gif" width="160" height="20" border="0" alt="Edit PDF-Archiv"></a></div>
          </td>
        </tr>
        <tr valign="top">
          <td height="20"><img src="images/transparent.gif" width="20" height="20"></td>
          <td height="20">
            <div align="right"><a href="anleitungen.php" target="_self"><img src="images/un-editanleitungen.gif" width="160" height="20" border="0" alt="Edit Gebrauchsanleitungen"></a></div>
          </td>
        </tr>
        <tr valign="top"> 
          <td height="20" width="20"><img src="images/transparent.gif" width="20" height="20"></td>
          <td height="20" width="175"> 
            <div align="right"><a href="galerie-liste.php" target="_self"><img src="images/un-editgalerie.gif" width="160" height="20" border="0" alt="Edit Fotogalerie"></a></div>
          </td>
        </tr>
        <tr valign="top">
          <td height="20"><img src="images/transparent.gif" width="20" height="20"></td>
          <td height="20">
            <div align="right"><a href="angebot.php" target="_self"><img src="images/un-angebot.gif" width="160" height="20" border="0" alt="Edit Angebot"></a></div>
          </td>
        </tr>
      </table>
    </td>
    <td width="680"> 
      <table width="680" border="0" cellspacing="0" cellpadding="0">
        <tr valign="top"> 
          <td colspan="19" height="30"><img src="images/ht-datenbanken.gif" width="680" height="30"></td>
        </tr>
        <tr valign="top"> 
          <td height="30"> </td>
          <td colspan="18" height="30"><img src="images/ut-editprodukt.gif" width="630" height="30"></td>
        </tr>
        <tr valign="top"> 
          <td width="50"><img src="images/transparent.gif" width="50" height="20"></td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
        </tr>
        <tr valign="top"> 
          <td width="50"> </td>
          <td width="20"> </td>
          <td colspan="17" class="text"> 
            <div align="left">Der Eintrag wurde eingefügt/übernommen.<br>
              <br>
            </div>
          </td>
        </tr>
        <tr valign="top"> 
          <td width="50"> </td>
          <td width="20"> </td>
          <td colspan="5" class="text"><a href="produkte-liste.php" class="text-link">zurück</a></td>
          <td class="text"> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td class="text"> </td>
          <td class="text"> </td>
          <td class="text"> </td>
          <td class="text"> </td>
          <td class="text"> </td>
          <td class="text"> </td>
        </tr>
        <tr valign="top"> 
          <td width="50"><img src="images/transparent.gif" width="50" height="20"></td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
        </tr>
        <tr valign="top"> 
          <td width="50"> </td>
          <td colspan="18"><img src="images/linie-630.gif" width="630" height="1"></td>
        </tr>
        <tr valign="top"> 
          <td width="50"><img src="images/transparent.gif" width="50" height="10"></td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
        </tr>
        <tr> 
          <td width="50"><img src="images/transparent.gif" width="50" height="1"></td>
          <td width="20"><img src="images/transparent.gif" width="20" height="1"></td>
          <td width="50"><img src="images/transparent.gif" width="50" height="1"></td>
          <td width="20"><img src="images/transparent.gif" width="20" height="1"></td>
          <td width="50"><img src="images/transparent.gif" width="50" height="1"></td>
          <td width="20"><img src="images/transparent.gif" width="20" height="1"></td>
          <td width="50"><img src="images/transparent.gif" width="50" height="1"></td>
          <td width="20"><img src="images/transparent.gif" width="20" height="1"></td>
          <td width="50"><img src="images/transparent.gif" width="50" height="1"></td>
          <td width="20"><img src="images/transparent.gif" width="20" height="1"></td>
          <td width="50"><img src="images/transparent.gif" width="50" height="1"></td>
          <td width="20"><img src="images/transparent.gif" width="20" height="1"></td>
          <td width="50"><img src="images/transparent.gif" width="50" height="1"></td>
          <td width="20"><img src="images/transparent.gif" width="20" height="1"></td>
          <td width="50"><img src="images/transparent.gif" width="50" height="1"></td>
          <td width="20"><img src="images/transparent.gif" width="20" height="1"></td>
          <td width="50"><img src="images/transparent.gif" width="50" height="1"></td>
          <td width="20"><img src="images/transparent.gif" width="20" height="1"></td>
          <td width="50"><img src="images/transparent.gif" width="50" height="1"></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>

 

Link to comment
Share on other sites

hmm, strange. try debugging a little:

 

  $fsizesmall=filesize($bild_small);
  
  exit('$fsizesmall = "'.$fsizesmall.'"; $bild_small = "'.$bild_small.'";');
  
  $bild_small_2=addslashes(fread(fopen($bild_small,"r"),$fsizesmall));

if (file_exists($bild)) {
		unlink($bild);
		}
if (file_exists($bild_small)) {
		unlink($bild_small);
		}
}
else
{
	$info = "<span class=\"text-titel\">Achtung! Sie haben keine JPEG Datei übertragen! Das Bild wurde nicht gespeichert</SPAN><BR>\n";
	$bild = "none";}
}  

Link to comment
Share on other sites

your filesize function is failing i think, or the file is in fact 0 bytes (doubtful).

 

take out the exit function i put in, then try this

 

  $fsizesmall=filesize($bild_small);
  
  var_dump(filesize($bild_small)); var_dump(file_exists($bild_small)); exit();
  
  $bild_small_2=addslashes(fread(fopen($bild_small,"r"),$fsizesmall));

if (file_exists($bild)) {
		unlink($bild);
		}
if (file_exists($bild_small)) {
		unlink($bild_small);
		}
}
else
{
	$info = "<span class=\"text-titel\">Achtung! Sie haben keine JPEG Datei übertragen! Das Bild wurde nicht gespeichert</SPAN><BR>\n";
	$bild = "none";}
}  

 

I put in a couple of var_dump()'s to help debug this. You will need to give us the Output Source-code (HTML Source-code).

---

 

if you can, verify the location of the tmp directory, and that the file exists in that location. (Am i right in assuming the exec() function should create a new file named/located $bild_small?

 

if so make sure your server you are hosting this on has access to the exec() function (you may need to ask your server administrator).

 

 

hope this helps,

Link to comment
Share on other sites

ok undo the changes i made.

 

 

it seems like the exec function is failing, the new server must have different setup, as exec communicates with the shell of the operating system (eg, DOS for windows).

 

http://uk2.php.net/manual/en/function.exec.php

 

-------

 

try this:

 

	if($isize['0'] > 190){
	var_dump(exec("djpeg -pnm $bild | pnmscale -xsize 190 | pnmalias | cjpeg -smooth 1 >$bild_small"));
}else{
	$bild_small = $bild; }
exit();

Link to comment
Share on other sites

I'm confused now

can you put that into my code ? i don't know if i should take out all the changes or  only the  3 lines

 

<?php

include("../inc/db.inc");



if (file_exists($bild)) {
  $bild_small = $bild . "_small.jpg";
  $isize = getimagesize($bild);
  if($isize['2'] == 2)
{
  $typ = "image/jpeg";
  $width = $isize['0'];
  $height = $isize['1'];
  //if($isize['0'] > $isize['1']) 
//	{
if($isize['0'] > 190)
	  exec("djpeg -pnm $bild | pnmscale -xsize 190 | pnmalias | cjpeg -smooth 1 >$bild_small");
else
$bild_small = $bild;

//}
//	  else
//	{
//	if($isize['1'] > 190)
//		  exec("djpeg -pnm $bild | pnmscale -ysize 190 | pnmalias | cjpeg -smooth 1 >$bild_small");
//	
//	else
//	$bild_small = $bild;
//
//	}

  $fsizesmall=filesize($bild_small);
  
  $bild_small_2=addslashes(fread(fopen($bild_small,"r"),$fsizesmall));

if (file_exists($bild)) {
		unlink($bild);
		}
if (file_exists($bild_small)) {
		unlink($bild_small);
		}
}
else
{
	$info = "<span class=\"text-titel\">Achtung! Sie haben keine JPEG Datei übertragen! Das Bild wurde nicht gespeichert</SPAN><BR>\n";
	$bild = "none";}
}  

$kat = mysql_query("SELECT * FROM kategorie WHERE kategorie_de = '$kategorie_de'");
if (mysql_numrows($kat) == 1)
	{
		$kategorie_de = mysql_result($kat, 0, "kategorie_de");
		$kategorie_en = mysql_result($kat, 0, "kategorie_en");
		$kategorie_fr = mysql_result($kat, 0, "kategorie_fr");
	}


if (($number == 0) || ($number == ""))
{
	$result = mysql_query("insert into produkt VALUES('$number','$produktname_de','$produktname_en','$produktname_fr','$sort_id','$artikel_nr','$kategorie_de','$kategorie_en','$kategorie_fr','$beschreibung_de','$beschreibung_en','$beschreibung_fr','$zubehoer_de','$zubehoer_en','$zubehoerfr','$masse','$gewicht','$preis_de','$preis_en','$preis_fr','$bild_small_2')");

}
else
{
	if($bild == "none")
		{
		$result = mysql_query("update produkt set number='$number',produktname_de='$produktname_de',produktname_en='$produktname_en',produktname_fr='$produktname_fr',sort_id='$sort_id',artikel_nr='$artikel_nr',kategorie_de='$kategorie_de',kategorie_en='$kategorie_en',kategorie_fr='$kategorie_fr',beschreibung_de='$beschreibung_de',beschreibung_en='$beschreibung_en',beschreibung_fr='$beschreibung_fr',zubehoer_de='$zubehoer_de',zubehoer_en='$zubehoer_en',zubehoer_fr='$zubehoerfr',masse='$masse',gewicht='$gewicht',preis_de='$preis_de',preis_en='$preis_en',preis_fr='$preis_fr' WHERE number='$number'");
		}
	else
		$result = mysql_query("update produkt set number='$number',produktname_de='$produktname_de',produktname_en='$produktname_en',produktname_fr='$produktname_fr',sort_id='$sort_id',artikel_nr='$artikel_nr',kategorie_de='$kategorie_de',kategorie_en='$kategorie_en',kategorie_fr='$kategorie_fr',beschreibung_de='$beschreibung_de',beschreibung_en='$beschreibung_en',beschreibung_fr='$beschreibung_fr',zubehoer_de='$zubehoer_de',zubehoer_en='$zubehoer_en',zubehoer_fr='$zubehoerfr',masse='$masse',gewicht='$gewicht',preis_de='$preis_de',preis_en='$preis_en',preis_fr='$preis_fr',bild='$bild_small_2' WHERE number='$number'");
}

if ($result == 0)
	fail("Der Datensatz enthþlt einen Fehler und konnte NICHT eingefŸgt werden.");




?>
<html>
<head>
<title>MS PROTECT AG</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="daten/font.css">
<script language="JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000" link="#1F3664" vlink="#1F3664" alink="#1F3664" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="images/hintergrund.gif" onLoad="MM_preloadImages('images/hn-home-2.gif','images/hn-info-2.gif','images/hn-datenbanken-2.gif')">
<table width="890" border="0" cellspacing="0" cellpadding="0">
  <tr valign="top"> 
    <td width="50"><img src="images/transparent.gif" width="50" height="20"></td>
    <td width="160"> </td>
    <td width="680"> </td>
  </tr>
  <tr valign="top"> 
    <td width="50"> </td>
    <td colspan="2"><a href="de/home.html" target="_self"><img src="images/logo-head.gif" width="230" height="41" border="0" alt="Home"></a></td>
  </tr>
  <tr valign="top"> 
    <td width="50"> </td>
    <td colspan="2"><img src="images/linie-840.gif" width="840" height="1"></td>
  </tr>
  <tr valign="top"> 
    <td height="30"><img src="images/transparent.gif" width="50" height="30"></td>
    <td height="30"> </td>
    <td width="680"> </td>
  </tr>
  <tr valign="top"> 
    <td colspan="2"> 
      <table width="195" border="0" cellspacing="0" cellpadding="0">
        <tr valign="top"> 
          <td height="30"><img src="images/transparent.gif" width="20" height="30"></td>
          <td height="30"> </td>
        </tr>
        <tr valign="top"> 
          <td height="40" width="20"><img src="images/transparent.gif" width="20" height="40"></td>
          <td height="40" width="175"><a href="index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('HOME','','images/hn-home-2.gif',1)" target="_self"><img name="HOME" border="0" src="images/hn-home-1.gif" width="175" height="30" alt="HOME"></a></td>
        </tr>
        <tr valign="top"> 
          <td height="40" width="20"><img src="images/transparent.gif" width="20" height="40"></td>
          <td height="40" width="175"><a href="info-flowchart.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Info','','images/hn-info-2.gif',1)" target="_self"><img name="Info" border="0" src="images/hn-info-1.gif" width="175" height="30" alt="INFO'S"></a></td>
        </tr>
        <tr valign="top"> 
          <td height="40" width="20"><img src="images/transparent.gif" width="20" height="40"></td>
          <td height="40" width="175"><a href="news-liste.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Datenbanken','','images/hn-datenbanken-2.gif',1)" target="_self"><img name="Datenbanken" border="0" src="images/hn-datenbanken-1.gif" width="175" height="30" alt="DATENBANKEN"></a></td>
        </tr>
        <tr valign="top"> 
          <td height="20" width="20"><img src="images/transparent.gif" width="20" height="20"></td>
          <td height="20" width="175"> 
            <div align="right"><a href="news-liste.php" target="_self"><img src="images/un-editnews.gif" width="160" height="20" border="0" alt="Edit News"></a></div>
          </td>
        </tr>
        <tr valign="top"> 
          <td height="20" width="20"><img src="images/transparent.gif" width="20" height="20"></td>
          <td height="20" width="175"> 
            <div align="right"><a href="kategorien-liste.php" target="_self"><img src="images/un-editkategorien.gif" width="160" height="20" border="0" alt="Edit Kategorien"></a></div>
          </td>
        </tr>
        <tr valign="top">
          <td height="20" width="20"><img src="images/transparent.gif" width="20" height="20"></td>
          <td height="20" width="175">
            <div align="right"><a href="produkte-liste.php" target="_self"><img src="images/un-editprodukte.gif" width="160" height="20" border="0" alt="Edit Kategorien"></a></div>
          </td>
        </tr>
        <tr valign="top"> 
          <td height="20" width="20"><img src="images/transparent.gif" width="20" height="20"></td>
          <td height="20" width="175"> 
            <div align="right"><a href="occasionen-liste.php" target="_self"><img src="images/un-editoccasionen.gif" width="160" height="20" alt="Edit Occasionen" border="0"></a></div>
          </td>
        </tr>
        <tr valign="top">
          <td height="20"><img src="images/transparent.gif" width="20" height="20"></td>
          <td height="20"><div align="right"><a href="spezial-liste.php" target="_self"><img src="images/un-editspezialangebote.gif" alt="Edit Spezialangebot" width="160" height="20" border="0"></a></div>
          </td>
        </tr>
        <tr valign="top"> 
          <td height="20" width="20"><img src="images/transparent.gif" width="20" height="20"></td>
          <td height="20" width="175"> 
            <div align="right"><a href="pdf-liste.php" target="_self"><img src="images/un-editpdfarchiv.gif" width="160" height="20" border="0" alt="Edit PDF-Archiv"></a></div>
          </td>
        </tr>
        <tr valign="top">
          <td height="20"><img src="images/transparent.gif" width="20" height="20"></td>
          <td height="20">
            <div align="right"><a href="anleitungen.php" target="_self"><img src="images/un-editanleitungen.gif" width="160" height="20" border="0" alt="Edit Gebrauchsanleitungen"></a></div>
          </td>
        </tr>
        <tr valign="top"> 
          <td height="20" width="20"><img src="images/transparent.gif" width="20" height="20"></td>
          <td height="20" width="175"> 
            <div align="right"><a href="galerie-liste.php" target="_self"><img src="images/un-editgalerie.gif" width="160" height="20" border="0" alt="Edit Fotogalerie"></a></div>
          </td>
        </tr>
        <tr valign="top">
          <td height="20"><img src="images/transparent.gif" width="20" height="20"></td>
          <td height="20">
            <div align="right"><a href="angebot.php" target="_self"><img src="images/un-angebot.gif" width="160" height="20" border="0" alt="Edit Angebot"></a></div>
          </td>
        </tr>
      </table>
    </td>
    <td width="680"> 
      <table width="680" border="0" cellspacing="0" cellpadding="0">
        <tr valign="top"> 
          <td colspan="19" height="30"><img src="images/ht-datenbanken.gif" width="680" height="30"></td>
        </tr>
        <tr valign="top"> 
          <td height="30"> </td>
          <td colspan="18" height="30"><img src="images/ut-editprodukt.gif" width="630" height="30"></td>
        </tr>
        <tr valign="top"> 
          <td width="50"><img src="images/transparent.gif" width="50" height="20"></td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
        </tr>
        <tr valign="top"> 
          <td width="50"> </td>
          <td width="20"> </td>
          <td colspan="17" class="text"> 
            <div align="left">Der Eintrag wurde eingefügt/übernommen.<br>
              <br>
            </div>
          </td>
        </tr>
        <tr valign="top"> 
          <td width="50"> </td>
          <td width="20"> </td>
          <td colspan="5" class="text"><a href="produkte-liste.php" class="text-link">zurück</a></td>
          <td class="text"> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td class="text"> </td>
          <td class="text"> </td>
          <td class="text"> </td>
          <td class="text"> </td>
          <td class="text"> </td>
          <td class="text"> </td>
        </tr>
        <tr valign="top"> 
          <td width="50"><img src="images/transparent.gif" width="50" height="20"></td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
        </tr>
        <tr valign="top"> 
          <td width="50"> </td>
          <td colspan="18"><img src="images/linie-630.gif" width="630" height="1"></td>
        </tr>
        <tr valign="top"> 
          <td width="50"><img src="images/transparent.gif" width="50" height="10"></td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
          <td width="20"> </td>
          <td width="50"> </td>
        </tr>
        <tr> 
          <td width="50"><img src="images/transparent.gif" width="50" height="1"></td>
          <td width="20"><img src="images/transparent.gif" width="20" height="1"></td>
          <td width="50"><img src="images/transparent.gif" width="50" height="1"></td>
          <td width="20"><img src="images/transparent.gif" width="20" height="1"></td>
          <td width="50"><img src="images/transparent.gif" width="50" height="1"></td>
          <td width="20"><img src="images/transparent.gif" width="20" height="1"></td>
          <td width="50"><img src="images/transparent.gif" width="50" height="1"></td>
          <td width="20"><img src="images/transparent.gif" width="20" height="1"></td>
          <td width="50"><img src="images/transparent.gif" width="50" height="1"></td>
          <td width="20"><img src="images/transparent.gif" width="20" height="1"></td>
          <td width="50"><img src="images/transparent.gif" width="50" height="1"></td>
          <td width="20"><img src="images/transparent.gif" width="20" height="1"></td>
          <td width="50"><img src="images/transparent.gif" width="50" height="1"></td>
          <td width="20"><img src="images/transparent.gif" width="20" height="1"></td>
          <td width="50"><img src="images/transparent.gif" width="50" height="1"></td>
          <td width="20"><img src="images/transparent.gif" width="20" height="1"></td>
          <td width="50"><img src="images/transparent.gif" width="50" height="1"></td>
          <td width="20"><img src="images/transparent.gif" width="20" height="1"></td>
          <td width="50"><img src="images/transparent.gif" width="50" height="1"></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>

Link to comment
Share on other sites

just use the original code you posted.

 

and use my snippet:

 

<?php

include("../inc/db.inc");



if (file_exists($bild)) {
  $bild_small = $bild . "_small.jpg";
  $isize = getimagesize($bild);
  if($isize['2'] == 2)
{
  $typ = "image/jpeg";
  $width = $isize['0'];
  $height = $isize['1'];
  //if($isize['0'] > $isize['1']) 
//	{
if($isize['0'] > 190){
	var_dump(exec("djpeg -pnm $bild | pnmscale -xsize 190 | pnmalias | cjpeg -smooth 1 >$bild_small"));
}else{
	$bild_small = $bild; }
exit();

Link to comment
Share on other sites

ok that was a long shot.

 

This is as far as i personally can go (i do not know/nor have i ever, used the exec() function).

Looks like unix/linux style shell command - i do not know either at all :/, sorry.

 

The only thing i can suggerst myself is to find out any major differences in operating systems/shell comands between your two servers. exec seems to be making the filename but with 0 bytes, looks like the image editing part of the command is failing somehow.

------

 

Alternatively you could use the GD extension, but possible more complicated (perhaps).

 

hope this helps,

Link to comment
Share on other sites

I had this yesterday.  At glance it looks like your giving fread a length parameter of 0 for some reason. I know your retrieving the filesize of the file your reading but like me, having issues with it.  I just entered a straight number based on how big I knew the files could get.  Like a one line text file I knew would not get over 4069, so I used it because it was on a php manual example.  Try finding your biggest file possible and set the limit to that.

Link to comment
Share on other sites

i get the info from my provider that exec command must have php safe mode on and get

 

Warning: filesize() [function.filesize]: SAFE MODE Restriction in effect. The script whose uid is 10160 is not allowed to access /tmp owned by uid 0 in /srv/www/vhosts/msprotect.ch/httpdocs/admin/produkte-edit-ok.php on line 33

Warning: filesize() [function.filesize]: stat failed for /tmp/phpuln5Y1_small.jpg in /srv/www/vhosts/msprotect.ch/httpdocs/admin/produkte-edit-ok.php on line 33

Warning: fopen() [function.fopen]: Unable to access /tmp/phpuln5Y1_small.jpg in /srv/www/vhosts/msprotect.ch/httpdocs/admin/produkte-edit-ok.php on line 35

Warning: fopen(/tmp/phpuln5Y1_small.jpg) [function.fopen]: failed to open stream: No such file or directory in /srv/www/vhosts/msprotect.ch/httpdocs/admin/produkte-edit-ok.php on line 35

Warning: fread(): supplied argument is not a valid stream resource in /srv/www/vhosts/msprotect.ch/httpdocs/admin/produkte-edit-ok.php on line 35 

 

in info.php i have

 

upload_tmp_dir no value no value

user_dir no value no value

 

 

 

 

 

Link to comment
Share on other sites

'upload_tmp_dir' is '/tmp'.

 

 

i use cgi-lib.pl for upload

 

($cgi_lib'version = '$Revision: 2.8 $') =~ s/[^.\d]//g;


# Parameters affecting cgi-lib behavior
# User-configurable parameters affecting file upload.
$cgi_lib'maxdata    = 1931072;    # maximum bytes to accept via POST - 2^17
$cgi_lib'writefiles =      0;    # directory to which to write files, or
                                 # 0 if files should not be written
$cgi_lib'filepre    = "cgi-lib"; # Prefix of file names, in directory above

# Do not change the following parameters unless you have special reasons
$cgi_lib'bufsize  =  8192;    # default buffer size when reading multipart
$cgi_lib'maxbound =   100;    # maximum boundary length to be encounterd
$cgi_lib'headerout =    0;    # indicates whether the header has been printed

 

 

 

Link to comment
Share on other sites

Safe mode Restriction? - Looks like exec may not work if safe mode is on (IMO - though not sure if true).

 

i would suggest using GD - i dont think that exec function is cross-platform compatible...

http://uk2.php.net/gd

 

Although GD is not exactly cross-platform as GD is not on default installations of PHP, but most hosting services (or any host calling them selves a sevice) should have this installed, GD 2.

 

are you aware of phpinfo(); function? check for temporary directory locations etc - also are you actually using a perl uploading script? make a php uploading script if so or make a perl handler to handle the images.

May have something to do with Perl and PHP Compatibility.

 

Personally i would always code the asme language unless there really are no potential issues. make sure the folders have the correct permissions also - in PHP it's very easy to manage uplaods, its strange that filesize won't work because of safe-mode restriction... I'm not sure if PHP realises you have just uploaded a file to that folder, so it might not let you in - just a thought :P

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.