• 01-09-2014, 17:01:34
    #1
    Merhaba
    Opencart XML import pro modülü ile ürünler yükleniyor fakat resim yükleme adımında aşağıdaki hatayı alıyorum. Resimler 0byte olarak yükleniyor. Klaösr izinleri normal.

    Sıkıntı ne olabilir?

    Notice: getimagesize(): Read error! in /home/magazapl/public_html/admin/controller/tool/xml_import.php on line 732

    Fonksiyon bu

    /*
    	 * 
    	 * function fetchImage
    	 * 
    	 * @desc - fetches an image from a URL. If the URL contains a ? character the new image's filename
    	 * will be the md5 of the full URL. If not, it will be the last portion of the URL (after the last /).
    	 * If the image URL returns a 404 the image will be deleted and an empty string returned.
    	 * 
    	 * @param (string) the image url to fetch
    	 * @return (string) the name of the fetched file on disk relative to the image/ dir or empty string on 404
    	 * 
    	 */
    	public function fetchImage($image_url, $folder='') {
    		if (strpos($image_url, 'http') !== 0) {
    			return '';
    		}
    		if($folder != '') {
    			$new_folder = DIR_IMAGE . 'data/' . $folder;
    			if (!file_exists($new_folder)) {
    				mkdir($new_folder, 0777, true);
    			}
    		}
    		
    		if (strstr($image_url, '?')) {
    			if($folder != '') {
    				$filename = 'data/' . $folder . '/' . md5($image_url) . '.jpg';
    			} else {
    				$filename = 'data/' . md5($image_url) . '.jpg';
    			}
    		} else {
    			$url_parts = explode('/', $image_url);
    			
    			if($folder != '') {
    				$filename = 'data/' . $folder . '/' . end($url_parts);
    			} else {
    				$filename = 'data/' . end($url_parts);
    			}
    			
    		}
    		if (!file_exists(DIR_IMAGE . $filename)) {
    			$fp = fopen(DIR_IMAGE . $filename, 'w');
    			$ch = curl_init();
    			curl_setopt($ch, CURLOPT_URL, $image_url);
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
    
    			curl_setopt($ch, CURLOPT_FILE, $fp);
    			curl_exec($ch);
    			$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    			curl_close($ch);
    			fclose($fp);
    			$file_info = getimagesize(DIR_IMAGE . $filename);
    			if($httpCode == 404 || empty($file_info) || strpos($file_info['mime'], 'image/') !== 0) {
    				unlink(DIR_IMAGE . $filename);
    				$filename = '';
    			}
    		}
    
    		return $filename;
    	}


    --R10.NET; Flood Engellendi -->-> Yeni yazılan mesaj 17:01:34 -->-> Daha önceki mesaj 15:26:20 --

    Ücretli yardım seçeneği de açıktır.
  • 20-09-2014, 12:04:37
    #2
    fwrite eksik, çalıştırılan curl ile alınan veri açılan resim içerisine kaydettirilmemiş.
  • 20-09-2014, 13:06:11
    #3
    Kimlik doğrulama veya yönetimden onay bekliyor.
    @sitedizaynnet;

    /*
         * 
         * function fetchImage
         * 
         * @desc - fetches an image from a URL. If the URL contains a ? character the new image's filename
         * will be the md5 of the full URL. If not, it will be the last portion of the URL (after the last /).
         * If the image URL returns a 404 the image will be deleted and an empty string returned.
         * 
         * @param (string) the image url to fetch
         * @return (string) the name of the fetched file on disk relative to the image/ dir or empty string on 404
         * 
         */
        public function fetchImage($image_url, $folder='') {
            if (strpos($image_url, 'http') !== 0) {
                return '';
            }
            if($folder != '') {
                $new_folder = DIR_IMAGE . 'data/' . $folder;
                if (!file_exists($new_folder)) {
                    mkdir($new_folder, 0777, true);
                }
            }
            
            if (strstr($image_url, '?')) {
                if($folder != '') {
                    $filename = 'data/' . $folder . '/' . md5($image_url) . '.jpg';
                } else {
                    $filename = 'data/' . md5($image_url) . '.jpg';
                }
            } else {
                $url_parts = explode('/', $image_url);
                
                if($folder != '') {
                    $filename = 'data/' . $folder . '/' . end($url_parts);
                } else {
                    $filename = 'data/' . end($url_parts);
                }
                
            }
            if (!file_exists(DIR_IMAGE . $filename)) {
                $fp = fopen(DIR_IMAGE . $filename, 'w');
                $ch = curl_init();
                curl_setopt($ch, CURLOPT_URL, $image_url);
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
    
                curl_setopt($ch, CURLOPT_FILE, $fp);
    			/*  */
                fwrite($fp, curl_exec($ch));
    			/*  */
                $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
                curl_close($ch);
                fclose($fp);
                $file_info = getimagesize(DIR_IMAGE . $filename);
                if($httpCode == 404 || empty($file_info) || strpos($file_info['mime'], 'image/') !== 0) {
                    unlink(DIR_IMAGE . $filename);
                    $filename = '';
                }
            }
    
            return $filename;
        }
  • 21-09-2014, 17:28:41
    #4
    Sorun sunucunun hosts dosyasındaymış.

    Herkese teşekkürler.
  • 09-04-2016, 04:52:06
    #5
    Merhaba arkadaslar siteme Total Import PRO ile xml cekerken aşagidaki hatayı alıyorum yardımcı olabilecek arkadas varmi?
    /home/gasde453/public_html/system/database/mysqli.php on line 41
  • 21-01-2022, 03:17:02
    #6
    Kimlik doğrulama veya yönetimden onay bekliyor.
    sitedizaynnet adlı üyeden alıntı: mesajı görüntüle
    Sorun sunucunun hosts dosyasındaymış.

    Herkese teşekkürler.
    merhaba host dosyasında ne gibi bir düzeltme yaptınız yardımcı olursanız sevinirim
  • 21-01-2022, 04:11:15
    #7
    mustafasinger adlı üyeden alıntı: mesajı görüntüle
    merhaba host dosyasında ne gibi bir düzeltme yaptınız yardımcı olursanız sevinirim
    Bu hata hakkında bende bir çözüm buldum
    resim klasör adlarındaki özel karakter boşluk gibi klasör isimlendirmeleri resimleri çekmeyi engelliyor. resim klasörlerinde isimlendirmelerde mutlaka alt tire yada boşluksuz olmalı
    bu aynı hata için benim çözüm yolum oldu