Ne olursa olsun ben ne, bu PHP fonksiyon alışkanlık, neden dizini bulmak?

2 Cevap

Ben şimdi bu anlamaya çalışırken birkaç saat geçirdim.

Ben, sunucu üzerinde bir görüntü almak için bu işlevi var onu, yeniden boyutlandırmak ve geçici bir yere kaydedin kopyalayın.

The function works and is tested inside another php file. But THIS PHP FILE refuse to find the folder '../temp_images' (you can see it in the variable $temp_path).

Ben sunucu kök vb ekleyerek şeyler her türlü denedim ..

Does anybody know why this function cant find the path to the directory in this php file, but it can in another php file in the same folder? The function I am referring to is at bottom of the code, imagejpeg();

İşte fonksiyonu (kısaltılmış) olduğunu:

function show_pics($tot_pics, $id_string, $category){

    	$ad_id_stripped = end( explode( '_', $id_string ) );
    	$img_path="SV/main/ad_images/$category/";
    	$temp_path="../temp_images/remove_images/";
    	$maxH = 70;
    	$maxW = 93;
     	$top_offset = 0;
    	for ($i=1; $i<=$tot_pics; $i++){

    				 $image_p = imagecreatetruecolor($fwidth, $blank_height);
                     $white = imagecolorallocate($image_p, 255, 255, 255);
                     imagefill($image_p, 0, 0, $white);

    				 $image = imagecreatefromjpeg('../ad_images/'.$category.'/'.$ad_id_stripped.'_'.$i.'.jpg');

    				 imagecopyresampled($image_p, $image, 0, $top_offset, 0, 0, $fwidth, $fheight, $width_orig, $height_orig);

    				 imagejpeg($image_p, $temp_path, 100);


    	}}

Teşekkürler

2 Cevap

Bu PHP dosyası nerede bulunur? Ve kodunuzda her yerde $ temp_path kullanmak değil mi? :)

http://be2.php.net/imagejpeg ikinci parametre bir dosya adı değil, bir dizin olmalıdır.

This function is used to display random image i.e. at header position of a site. It reads the whole directory and then randomly print the image. I think it may be useful............