folder Tahribat.com Forumları
linefolder Asp - Php - Cgi - Perl
linefolder Php"De Dizin Gösterme Problemi



Php"De Dizin Gösterme Problemi

  1. KısayolKısayol reportŞikayet pmÖzel Mesaj
    RuzgaR
    RuzgaR's avatar
    Banlanmış Üye
    Kayıt Tarihi: 08/Ağustos/2005
    Erkek
     Selamünaleyküm;
    Ben aşşağıda ki doya da anadizin/tmp yerine anadizin/altdizin/tmp kalsorune resmin atanmasını nasıl sağlarım.Zaten yardımcı olabilecekler için fazla açıklama yapmama gerek yok.Kullanıcı avatar belirlerken iki tıklaavatarını kesip öyle kabul edecek ama avatar ı  gösterirken problem yasiyorum.Atamasında,kesmesinde problem yok.yalnız resmi goremiyor cunku resmi www.site.com/site/tmp yerine www.site.com/tmp klasorunde gostermeye calisiyor.halbuki resmi atadigi siteadi.com/site/tmp klasorunde resim duruyor.
     
     
     
     
     
     
     
     
    <?php



    class getAvatarsTab extends cbTabHandler 
        {

    function getFormat($file) {
    $ext = strtolower(substr($file,strpos($file,".")+1));
    if($ext == "jpg" or $ext == "jpeg")
      {
      $format = 'jpeg';
      }
      elseif ($ext == "gif")
      {
      $format = 'gif';
      }
      elseif($ext == "png")
      {
      $format = 'png';
      }
      
      return $format;
    }



        function getAvatarsTab() 
            {
            $this->cbTabHandler();
            }

        function getDisplayTab($tab,$user,$ui) 
            {
            /* */
            global $mainframe;
            global $database;
            global $my;
            global $mosConfig_absolute_path;
            global $mosConfig_absolute_path;
          global $mosConfig_live_site;
           
            if(@class_exists(JFactory)){$j10=0;}else{$j10=1;}
            
            
            if($j10)        
            {
           $user=$my;
           $db=$database;
           $abspath=$mosConfig_absolute_path;
           }        
           else        
           {
            $db = &JFactory::getDBO();
            $user =&JFactory::getUser();
            $abspath=getcwd();
           }
            
            $tmppath=$abspath."/tmp";
             //echo"[$j10]";
            
            $uid=$user->id;

            $params = $this->params; // get parameters (plugin and related tab)
            $maxHeightEditor = $params->get('maxHeightEditor', "500");
            $maxWidthEditor = $params->get('maxWidthEditor', "500");
            $maxHeight= $params->get('maxHeight', "250");
            $maxWidth= $params->get('maxHeight', "250");
            $forceSquare = $params->get('forceSquare', "0");
            $inlineCSS = $params->get('inlineCSS', "1");
            
            $textUpImage = $params->get('textUpImage', "Upload image");
            $textUpButton = $params->get('textUpButton', "Next &raquo;");
            $textCropImage = $params->get('textCropImage', "Crop image");
            $textCropButton = $params->get('textCropButton', "Next &raquo;");
            
            $textErrorCrop= $params->get('textErrorCrop', "Error cropping or copying the file!");
            $textErrorUploadFailed=$params->get('textErrorUploadFailed', "Error: File upload failed. Enter valid file.");
            
            $textErrorNotImage = $params->get('textErrorNotImage', "Uploaded file is not an image!");
            $textCropDescription = $params->get('textCropDescription', "");
            $textCropButtonClear = $params->get('textCropButtonClear', "Clear");
            $textBackButton = $params->get('textBackButton', "Back");
            
            $textAvatarSaved = $params->get('textAvatarSaved', "Avatar saved");
            $textAvatarPending = $params->get('textAvatarPending', "Your new avatar is pending moderator approval");
            
            $displayLink = $params->get('displayLink', "1");
            $requireApproval = $params->get('requireApproval', "0");
            
            
           
            $db->setQuery("SELECT avatar FROM #__comprofiler WHERE id='$uid'");
            $db->query();
            if($db->getNumRows())
            {
            $list=$db->loadObjectList();
            $uav="".$list[0]->avatar;
            }
            
           $return="<a name=\"getAvatarsTab\"></a>";
            
            if(!$_POST['upcontroller'])
            {
            $return.="
            <h4>$textUpImage</h4>
            
            <form  enctype=\"multipart/form-data\" method=\"post\" action=\"index.php?option=com_comprofiler&amp;tab=getAvatarsTab#getAvatarsTab\">
            <input type=\"file\" name=\"upfile\" />
            <input type=\"hidden\" name=\"upcontroller\" value=\"1\" />
            <input type=\"submit\" name=\"upbutton\" class=\"button\" value=\"$textUpButton\" />
            </form>
            
            ";
            }
            
            if($_POST['upcontroller']==1)
            {
            
            if(file_exists($_FILES['upfile']['tmp_name']))
            {        
            $format=$this->getFormat($_FILES['upfile']['name']);
            if($format=='jpeg' || $format=='png')
                      {
            do {$tmpfile=$tmppath.'/'.time().'.jpg';} while(file_exists($tmpfile));
            
                      if(move_uploaded_file($_FILES['upfile']['tmp_name'],$tmpfile) && file_exists($tmpfile))
                      {


                      //get the image width and height
                       $imgsize=getimagesize($tmpfile);
                       $imgw=$imgsize['0'];$imgh=$imgsize['1'];
                       $ratio_orig = $imgw/$imgh;
                       
                       //if its too big, set resize to max values
                        if($imgw>$maxWidthEditor || $imgh>$maxHeightEditor)
                        {
                        if ($maxWidthEditor/$maxHeightEditor > $ratio_orig) {
                           $maxWidthEditor = $maxHeightEditor*$ratio_orig;
                        } else {
                           $maxHeightEditor = $maxWidthEditor/$ratio_orig;
                        }
                       }
                       else
                       {
                       //if its not too big, just put it into jpg
                       $maxHeightEditor=$imgh;
                       $maxWidthEditor=$imgw;
                       }
                       
                      //some GD2 magic!
                       $image_p = imagecreatetruecolor($maxWidthEditor, $maxHeightEditor);
                      $image = @imagecreatefromjpeg($tmpfile);
                      if($format=='png') $image=imagecreatefrompng($tmpfile);
                      imagecopyresampled($image_p, $image, 0, 0, 0, 0, $maxWidthEditor, $maxHeightEditor, $imgw, $imgh);
                      imagejpeg($image_p,$tmpfile);
                      $imgsize=getimagesize($tmpfile);
                      $imgw=$imgsize['0'];$imgh=$imgsize['1'];
                      //resized!



                      if($inlineCSS) $return.="<link rel=\"stylesheet\" type=\"text/css\" href=\"components/com_comprofiler/plugin/user/plug_cjavatars/crop.css\" />";
                      
                      $return.="
                      <script type=\"text/javascript\" src=\"components/com_comprofiler/plugin/user/plug_cjavatars/Toolkit.Events.js\"></script>
                      <script type=\"text/javascript\" src=\"components/com_comprofiler/plugin/user/plug_cjavatars/Cropper.js\"></script>
                      
                      <h4>$textCropImage</h4>
                     <p>$textCropDescription</p>";
                         
                         
                      
                  $return.="<form id=\"cropForm\" action=\"?option=com_comprofiler&amp;tab=getAvatarsTab#getAvatarsTab\" method=\"post\">
                  <input type=\"hidden\" name=\"upcontroller\" value=\"2\" />
                  <input type=\"button\" class=\"button\" onclick=\"Cropper.reset();\" value=\"$textCropButtonClear\" />
                  <input type=\"submit\" class=\"button\" name=\"send\" value=\"$textCropButton\" />
                  
                   
                    <input type=\"hidden\" name=\"tmpfile\" value=\"$tmpfile\" />
                  <div id=\"cropImageContainer\" style=\"width:{$imgw}px;\">
                  <img id=\"cropImage\" src=\"".str_replace($abspath,$live_site,$tmpfile)."\" width=\"$imgw\" height=\"$imgh\" alt=\"\" /></div>
                  
                  <input type=\"hidden\" name=\"imageW\" id=\"imageW\" onchange=\"Cropper.formResetImgW();\" />
                  <input type=\"hidden\" name=\"imageH\" id=\"imageH\"  onchange=\"Cropper.formResetImgH();\" />
                  <input type=\"hidden\" name=\"cropX\" id=\"cropX\" onchange=\"Cropper.formSetX(this.value);\" />
                  <input type=\"hidden\" name=\"cropY\" id=\"cropY\"  onchange=\"Cropper.formSetY(this.value);\" />
                  <input type=\"hidden\" name=\"cropW\" id=\"cropW\"  onchange=\"Cropper.formSetW(this.value);\" />
                  <input type=\"hidden\" name=\"cropH\" id=\"cropH\" onchange=\"Cropper.formSetH(this.value);\" />
                  </form>";
                      
                      }
                      else
                      {
                      $return.="<p>File moving failed</p>
                      <p><a href=\"?option=com_comprofiler&amp;tab=getAvatarsTab\">&laquo; $textBackButton</a></p>";
                      }
            }
            else
            {
            $return.="<p>$textErrorNotImage</p>
            <p><a href=\"?option=com_comprofiler&amp;tab=getAvatarsTab\">&laquo; $textBackButton</a></p>";
            }
            }
            else
            {
            $return.="$textErrorUploadFailed
            <p><a href=\"?option=com_comprofiler&amp;tab=getAvatarsTab\">&laquo; $textBackButton</a></p>";
            }
           
         
         while(file_exists($filename));
            
            }
           
            if($_POST['upcontroller']==2)
            {
                $imgw=$_POST['imageW'];
                $imgh=$_POST['imageH'];
                $cropX=(int) $_POST['cropX'];
                $cropY=(int) $_POST['cropY'];
                $cropW=(int) $_POST['cropW'];
                $cropH=(int) $_POST['cropH'];
                $tmpfile=$_POST['tmpfile'];
                $tmpfile2=str_replace('.jpg','_.jpg',$tmpfile);//just a backup tmp file to crop/resize to
                copy($tmpfile,$tmpfile2);

                      //crop?
                      if($cropX && $cropY && $cropW && $cropH)
                      {
                       $image_p = imagecreatetruecolor($cropW, $cropH);
                      $image = imagecreatefromjpeg($tmpfile);
                     // echo "$image_p,$image,0,0,$cropX,$cropY,$cropW,$cropH,100";
                      imagecopymerge($image_p,$image,0,0,$cropX,$cropY,$cropW,$cropH,100);                  
                      imagejpeg($image_p,$tmpfile2,100);
                      //resized/cropped
                    $return.="<img src=".str_replace($abspath,'',$tmpfile2).">";
                    }
                    
                    
                            
                      //new image
                     $newavatarid=(int) $user->id."_".md5(microtime()).".jpg";
                    $newavatar="$abspath/images/comprofiler/".$newavatarid;
                    $newthumb="$abspath/images/comprofiler/tn".$newavatarid;
                     //get the image width and height
                       $imgsize=getimagesize($tmpfile2);
                       $imgw=$imgsize['0'];$imgh=$imgsize['1'];
                       $ratio_orig = $imgw/$imgh;

                       //if its too big, set resize to max values
                        if($imgw>$maxWidth || $imgh>$maxHeight)
                        {
                        if ($maxWidth/$maxHeight > $ratio_orig) {
                           $maxWidth = $maxHeight*$ratio_orig;
                        } else {
                           $maxHeight = $maxWidth/$ratio_orig;
                        }
                       }
                       else
                       {
                       //if its not too big, just put it into jpg
                       $maxHeight=$imgh;
                       $maxWidth=$imgw;
                       }
                       
                      //some GD2 magic!
                       $image_p = imagecreatetruecolor($maxWidth, $maxHeight);
                      $image = imagecreatefromjpeg($tmpfile2);
                      imagecopyresampled($image_p, $image, 0, 0, 0, 0, $maxWidth, $maxHeight, $imgw, $imgh);
                      imagejpeg($image_p,$newavatar,100);
                        $thWidth=60;
                        $thHeight=60;
                        
                          if ($thWidth/$thHeight > $ratio_orig) {
                           $thWidth = $thHeight*$ratio_orig;
                        } else {
                           $thHeight = $thWidth/$ratio_orig;
                        }
                        
                        $image_p = imagecreatetruecolor($thWidth, $thHeight);
                       imagecopyresampled($image_p, $image, 0, 0, 0, 0, $thWidth, $thHeight, $imgw, $imgh);
                        imagejpeg($image_p,$newthumb,100);
               
                
                $return.="<img src=$newavatar>";
                $return.="<img src=$newthumb>";
               
                
                if(file_exists($newavatar))
                {
                //unlink($tmpfile);
                //unlink($tmpfile2);
                //unlink($uav);
                $sql="UPDATE #__comprofiler SET  avatar='$newavatarid' ";
                if($requireApproval) 
                {$sql.=" , avatarapproved='0' ";
                 $msg=$textAvatarPending;
                
                }else
                {$sql.=" , avatarapproved='1' ";
                 $msg=$textAvatarSaved;
                }
                
                $sql.="WHERE id='$uid'";
                $db->setQuery($sql);
                //echo$sql;
                
                if($db->query())
                {
               
               
                
                if($j10)
                {
                mosRedirect('index.php?option=com_comprofiler&tab=getAvatarsTab',$msg);
                }
                else
                {
                $mainframe->redirect('index.php?option=com_comprofiler&tab=getAvatarsTab',$msg);
                }
                }
    //echo $db->stdErr();
                }
                else
                {
                $return.="$textErrorCrop
                <p><a href=\"?option=com_comprofiler&amp;tab=getAvatarsTab\">&laquo; $textBackButton</a></p>";
                }
            }
             
            if($_GET['user'] && $_GET['user']!=$user->id) $return='';
           
            return $return;
            } 
    ?>

    Aşk,Tanrı"nın Nefesini Hissetmektir!
  2. KısayolKısayol reportŞikayet pmÖzel Mesaj
    RuzgaR
    RuzgaR's avatar
    Banlanmış Üye
    Kayıt Tarihi: 08/Ağustos/2005
    Erkek

    En azından fikri olan çiziktirse...

    Aslında ben de İşte son nokta,

    Yahoo vs google

    Türkiye nereye gidiyor

    diye başlık açsam illa istemeden de olsa bakan biri bir fikir verir di: )

    illa yalanmı söyliyeyim : ) 


    Aşk,Tanrı"nın Nefesini Hissetmektir!
  3. KısayolKısayol reportŞikayet pmÖzel Mesaj
    hotboy
    hotboy's avatar
    Kayıt Tarihi: 08/Ağustos/2005
    Erkek
     $tmppath=$abspath."/tmp"; =>  $tmppath=$abspath."/altdizin/tmp";
  4. KısayolKısayol reportŞikayet pmÖzel Mesaj
    RuzgaR
    RuzgaR's avatar
    Banlanmış Üye
    Kayıt Tarihi: 08/Ağustos/2005
    Erkek

    hotboy bunu yazdı:
    -----------------------------
     $tmppath=$abspath."/tmp"; =>  $tmppath=$abspath."/altdizin/tmp";
    -----------------------------

    onu denemiştim kabul etmemekle beraber hata bile vermişti. 


    Aşk,Tanrı"nın Nefesini Hissetmektir!
  5. KısayolKısayol reportŞikayet pmÖzel Mesaj
    hotboy
    hotboy's avatar
    Kayıt Tarihi: 08/Ağustos/2005
    Erkek
    RuzgaR bunu yazdı:
    -----------------------------

    hotboy bunu yazdı:
    -----------------------------
     $tmppath=$abspath."/tmp"; =>  $tmppath=$abspath."/altdizin/tmp";
    -----------------------------

    onu denemiştim kabul etmemekle beraber hata bile vermişti. 


    -----------------------------

    hata mesajını alabilirmiyim?

  6. KısayolKısayol reportŞikayet pmÖzel Mesaj
    RuzgaR
    RuzgaR's avatar
    Banlanmış Üye
    Kayıt Tarihi: 08/Ağustos/2005
    Erkek
    Warning: move_uploaded_file(C:\Inetpub\vhosts\siteadi.com\httpdocs\ent/ent/tmp/1225733704.jpg): failed to open stream: No such file or directory inC:\Inetpub\vhosts\siteadi.com/httpdocs\ent\components\com_comprofiler\plugin\user\plug_cjavatars\cj_avatars.php on line 131

    Warning: move_uploaded_file(): Unable to move 'C:\WINDOWS\Temp\php530.tmp' to 'C:\Inetpub\vhosts\siteadi.com\httpdocs\ent/ent/tmp/1225733704.jpg' inC:\Inetpub\vhosts\siteadi.com\httpdocs\ent\components\com_comprofiler\plugin\user\plug_cjavatars\cj_avatars.php on line 131

    Aşk,Tanrı"nın Nefesini Hissetmektir!
  7. KısayolKısayol reportŞikayet pmÖzel Mesaj
    RuzgaR
    RuzgaR's avatar
    Banlanmış Üye
    Kayıt Tarihi: 08/Ağustos/2005
    Erkek

    Acaba sunucu da GD kütüphaneleri gibi kurulması gereken yerel bir eklenti mi gerektiriyor.
    ben eklentisiz çalışması gerektiğini düşünüyorum ve sunucunun bilmediğim noktası da yok.GD 2 kütüphanesi de kurulu!

     

     

    *malum satır :    

     

                 {

         do {$tmpfile=$tmppath.'/'.time().'.jpg';} while(file_exists($tmpfile));

            

     131.satır:                    if(move_uploaded_file($_FILES['upfile']['tmp_name'],$tmpfile) && file_exists($tmpfile))

                      {

     

     

                      //yuklenmis resmin yukseklik ve genisligini aliyoruz... ajaxloader yuklenene kadar bekliyor

                       $imgsize=getimagesize($tmpfile);

                       $imgw=$imgsize['0'];$imgh=$imgsize['1'];

                       $ratio_orig = $imgw/$imgh;

     

     

     

     

     

     

    Şimdi:

    gösterilecek resim :

      do {$tmpfile=$tmppath.'/'.time().'.jpg';} while(file_exists($tmpfile));

    demek ki:

     do{resimburda=site/altdizin/tmp/zamanolarakatanmisresimadi.jpg}....devam...

    tmppath=altdizin/tmp doğru

    çünkü;

            $tmppath=$abspath."/ent/tmp";

    değiştirdik.

    eee o zaman ne istiyor

    hatanın açıklamasını anlamadım gitti... 

     

     

     


    Aşk,Tanrı"nın Nefesini Hissetmektir!
  8. KısayolKısayol reportŞikayet pmÖzel Mesaj
    risperdal
    risperdal's avatar
    Kayıt Tarihi: 13/Haziran/2006
    Erkek
    alt dizinin permissionlarını 777 olarak ayarlayıp tekrar dener misin

    Özgür iradeydi şeytanım.
  9. KısayolKısayol reportŞikayet pmÖzel Mesaj
    RuzgaR
    RuzgaR's avatar
    Banlanmış Üye
    Kayıt Tarihi: 08/Ağustos/2005
    Erkek

    hackinger bunu yazdı:
    -----------------------------
    alt dizinin permissionlarını 777 olarak ayarlayıp tekrar dener misin
    -----------------------------

    permission istemiyor ve anadizine permission 777 yi alt dizinlerede uygulamak koşuluyla verdim. 

    şimdi kör gözüm gördü: ) burda site adini almamış direkt ana sunucu dizininde benim belirttiğim alt dizini görüyormuş

    C:\Inetpub\vhostshttpdocs\ent\components\com_comprofiler\plugin\user\plug_cjavatars\cj_avatars.php on line 131

     

    bakalım ne yapabileceğim 


    Aşk,Tanrı"nın Nefesini Hissetmektir!
Toplam Hit: 1053 Toplam Mesaj: 9