Перейти к контенту

Проблема с загрузкой фоток


Рекомендуемые сообщения

Устанановил себе галерею и при загрузке пишет что не возможно загрузить файл и выдает ошибку:

 

ПРЕДУПРЕЖДЕНИЕ IPB [2] move_uploaded_file(): SAFE MODE Restriction in effect. The script whose uid is 1068 is not allowed to access /home/anykey/public_html/uploads/1115745106 owned by uid 33 (Файл: /modules/gallery/lib/gallery_library.php. Строка: 628)

 

Не могу понять в чем дело может прова доступа не правильно выставил ???

Версия 1.3.1

Ссылка на комментарий
Поделиться на других сайтах

а вот ещё такая ошибка при загрузке фото!

 

Fatal error: Call to undefined function: imagecreatetruecolor() in z:\home\localhost\subdomain\forum\modules\gallery\lib\image.php on line 365

Ссылка на комментарий
Поделиться на других сайтах

2Anykey: "Вылечил" путем правки gallery_library.php - в нужных местах подменил "/" на "_". И убрал "mkdir". Теперь все картинки создаются в папке загрузки с првефиксами типа 111195405_gallery
Ссылка на комментарий
Поделиться на других сайтах

у меня такое пишет! че делать??

 

ПРЕДУПРЕЖДЕНИЕ IPB [2] mkdir(./uploads/1117375659): Permission denied (Файл: /modules/gallery/lib/gallery_library.php. Строка: 612)

ПРЕДУПРЕЖДЕНИЕ IPB [2] move_uploaded_file(./uploads/1117375659/gallery_24_2_2249.gif): failed to open stream: No such file or directory (Файл: /modules/gallery/lib/gallery_library.php. Строка: 628)

ПРЕДУПРЕЖДЕНИЕ IPB [2] move_uploaded_file(): Unable to move '/tmp/phphms0xE' to './uploads/1117375659/gallery_24_2_2249.gif' (Файл: /modules/gallery/lib/gallery_library.php. Строка: 628)

Ссылка на комментарий
Поделиться на других сайтах

Пажите

что галлери вообще не работает при сейф моде? или только отдельные ёё функции?

Ссылка на комментарий
Поделиться на других сайтах

Пажите

что галлери вообще не работает при сейф моде? или только отдельные ёё функции?

Отдельные функции. Типа:

1. Загрузить изображение

2. Показать изображение

;)

 

Во всем остальном - пашет :D

 

У меня после замены "/" на "_" запахало, но thumbnails не создаются. Буду рыть дальше.

Ссылка на комментарий
Поделиться на других сайтах

> У меня после замены "/" на "_" запахало, но thumbnails не создаются. Буду рыть дальше.

 

это не в GD дело и не в сейф моде

у меня в сейф моде пхп и всё нормально работает ( ну GD и thumbnail в самом форуме )

а значит и в галлери будет работать всё

и загрузка тоже должна работать

Ссылка на комментарий
Поделиться на других сайтах

это не в GD дело и не в сейф моде

у меня в сейф моде пхп и всё нормально работает ( ну GD и thumbnail в самом форуме )

а значит и в галлери будет работать всё

и загрузка тоже должна работать

А ты попробуй, попробуй, прежде чем утверждать :D

На пальцах: создается каталог, в него пишется файл. Все средствами PHP. А вот как раз в SAFE MODE move_uploaded_file этого не позволит сделать, если каталог создан не владельцем, а посредством PHP.

Ссылка на комментарий
Поделиться на других сайтах

Та насчёт загрузки файлов - это да ;) Я уже замечаю такие приколы, что закгружаешь скин какой-нибудь - папка с картинками создаётся, а картинок в ней нет :D

гы

 

Но GD должна нормально работать

Ссылка на комментарий
Поделиться на других сайтах

Но GD должна нормально работать

А она и работает. На форуме с thumnails никаких проблем. Дело, насколько я понимаю, в самом скрипте - я где-то чего-то или недоисправил, или наоборот, переисправил %).

Ссылка на комментарий
Поделиться на других сайтах

Ребят, ну помогите!

Залила Coppermine Photo Gallery и теперь при попытке загрузить фото туда, там выдает ошибку и вверху пишет:

 

Warning: move_uploaded_file(./albums/edit/mHTTP_temp_4f38ef5a.gif): failed to open stream: Permission denied in /home2/......./public_html/image/upload.php on line 1197

 

Warning: move_uploaded_file(): Unable to move '/tmp/phpoKri3W' to './albums/edit/mHTTP_temp_4f38ef5a.gif' in /home2/......./public_html/image/upload.php on line 1197

Ссылка на комментарий
Поделиться на других сайтах

Екатерина

а чёрт его знает в чём проблема

может это внатуре из-за сейф моде

я лично попросил своего хостера выключить мне сейф моде для моего акаунта - посмотрим как это скажется на работе :D

Ссылка на комментарий
Поделиться на других сайтах

  • 2 недели спустя...
2Anykey: "Вылечил" путем правки gallery_library.php - в нужных местах подменил "/" на "_". И убрал "mkdir". Теперь все картинки создаются в папке загрузки с првефиксами типа 111195405_gallery

можешь выложить код нового файла?

Ссылка на комментарий
Поделиться на других сайтах

Установил галерею, создал альбомы, выставил права - при попытке загрузить файл в галрею выдается ошибка:

 

IPB WARNING [2] process_uploaded_file(forum/gallery_mime_types.php): failed to open stream: No such file or directory (Line: 507 of /modules/gallery/lib/gallery_library.php)

 

как лечить?

 

заметил еще - при нажатии на кнопку NewImage - сверху пишется ошибка:

 

IPB WARNING [2] usort(): Invalid comparison function. (Line: 1925 of /modules/gallery/post.php)

 

:D

Ссылка на комментарий
Поделиться на других сайтах

  • 4 недели спустя...

не может быть, чтобы никто не знал, ведь у многих такая трабла![1121039536:1121039704]

2Anykey: "Вылечил" путем правки gallery_library.php - в нужных местах подменил "/" на "_". И убрал "mkdir". Теперь все картинки создаются в папке загрузки с првефиксами типа 111195405_gallery

 

где именно что заменять? :D((

Ссылка на комментарий
Поделиться на других сайтах

Вот код изменёного файла:

<?php
/**
 * Gallery Functions
 * 
 * General functions used throughout the gallery  
 * @version 1.3
 * @since 1.0
 * @access public
 * @copyright Invision Power Services, Inc
 **/
   
   /**
    * debug()
    * 
 * Prints out an array in a 'nice' format
 * 
 * @version 1.0
 * @since 1.0
 * @access public
 * 
    * @param $var
    * @return 
    **/
   function debug( $var )
   {
       echo "<div align='left'><PRE>"; print_r( $var ); echo "</PRE></div>";
   }

   /**
    * check_cat_auth()
    * 
 * Checks to see if we are authorized to view the
 * category.  Group permissions and category passwords
 * are both checked, execution is halted if the user
 * is unauthorized.
 * 
 * @version 1.0
 * @since 1.0
 * @access public
 * 
    * @param integer $cid
    * @param integer $password
    * @param array $perms_view
    * @return nothing
    **/
   function check_cat_auth( $cid, $password, $perms_view )
   {
       global $ibforums, $std, $HTTP_COOKIE_VARS;

       if( ! $std->check_perms( $perms_view ) )
       {         
           $std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission' ) );
       }

       if( $HTTP_COOKIE_VARS[ $ibforums->vars['cookie_id'].'IG'.$cid ] != $password )
       {
           $std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission' ) );
       }
   }

   /**
    * get_allowed_albums()
    * 
 * Returns an array of albums that the user is allowed
 * to see
 * 
 * @version 1.0
 * @since 1.0
 * @access public
 * 
    * @return array
    **/
   function get_allowed_albums()
   {
       global $ibforums, $DB;
       
       $DB->simple_construct( array( 'select' => 'id', 'from' => 'gallery_albums', 'where' => "public_album=1" ) );
       $DB->simple_exec();            

       while( $i = $DB->fetch_row() )
       {
           $album_cache[] = $i['id'];
       }

       return $album_cache;
   }

   /**
    * get_allowed_cats()
 * 
 * Generates an array of category id's that the user
 * is allowed to see.  If $pass_chk is set then it will make
 * sure we are authorized to view the password protectd category
    * 
 * @version 1.0
 * @since 1.0
 * @access public
 * 
    * @param integer $pass_chk
    * @return array
    **/
   function get_allowed_cats( $pass_chk=1, $category_data=array() )
   {
       global $ibforums, $DB, $HTTP_COOKIE_VARS, $std;
       
       // Grab a list of categories
       if( empty( $category_data ) )
       {
           $DB->simple_construct( array( 'select' => 'id, perms_thumbs, password', 'from' => 'gallery_categories' ) );
           $DB->simple_exec();

           while( $i = $DB->fetch_row() )
           {
               $category_data[] = $i;
           }
       }

       foreach( $category_data as $i )
       {
           // Check to see if we can view this category
           if( $std->check_perms( $i['perms_thumbs'] ) )
           {
               // We can, but does it have a password?
               if( empty( $i['password'] ) )
               {
                   $category_cache[] = $i['id'];
               }
               else
               {
                   // Should we check the password?
                   if( $pass_chk )
                   {
                       // Check password
                       if( $HTTP_COOKIE_VARS[ $ibforums->vars['cookie_id'].'IG'.$i['id'] ] == $i['password'] )
                       {
                           $category_cache[] = $i['id'];
                       }
                   }
                   else
                   {
                       $category_cache[] = $i['id'];
                   }
               }
           }
       }

       return $category_cache;
   }

   /**
    * is_media_allowed()
    * 
 * Returns true if the user can upload media
 * 
 * @version 1.2
 * @since 1.2
 * @access public
 * 
    * @param array $cat
    * @return bool
    **/
   function is_media_allowed( $cat )
   {
       global $ibforums;

       if( ! $cat['allow_movies'] )
       {
           return false;
       }

       if( ! $ibforums->member['g_movies'] )
       {
           return false;
       }

       return true;
   }

   /**
    * get_extension()
    * 
 * Generates an extension for the given image type
 * 
 * @version 1.0
 * @since 1.0
 * @access public
 * 
    * @param string $file_type
    * @return string
    **/
   function get_extension( $file_type )
   {
       switch( $file_type )
	 {
     case 'image/gif':
    	 $ext = '.gif';
      break;
      	 case 'image/jpeg':
  	 $ext = '.jpg';
    	 break;
        case 'image/pjpeg':
  	 $ext = '.jpg';
    	 break;
      	 case 'image/x-png':
  	 $ext = '.png';
    	 break;
      	 case 'image/png':
  	 $ext = '.png';
    	 break;
       }

       return $ext;
   }

   /**
    * make_image_tag()
 * 
 * Generates the tag for an image. If $tn is set, then it will
 * generate a tag for the image thumbnail
    * 
 * @version 1.2
 * @since 1.0
 * @access public
 * 
    * @param integer $id
    * @param integer $tn
    * @return string
    **/
   function make_image_tag( $i, $tn=0, $xy='' )
   {
       global $ibforums, $DB;
       
       // Thumbnail?
       $tn     = ( $tn ) ? '&tn=1' : '';
 $thumb  = ( $tn ) ? 'tn_' : '';
 $attach = ( $tn ) ? 'class="galattach"' : '';

 // Directory?
       $dir = ( $i['directory'] ) ? "&dir={$i['directory']}/" : "";
       $directory = ( $i['directory'] ) ? "{$i['directory']}/" : "";
       
       // Update bandwidth, if required
       if( $ibforums->vars['gallery_detailed_bandwidth'] && $ibforums->input['cmd'] == 'si' )
       {
           if( ! ( $tn && ! $ibforums->vars['gallery_bandwidth_thumbs'] ) )
           {
   $cut = time() - ( $ibforums->vars['gallery_bandwidth_period'] * 60 * 60 );
   
   if( ! $ibforums->del_bandwidth );
   {
               $DB->simple_delete( 'gallery_bandwidth', "date < {$cut}" ); $DB->simple_exec();
               $ibforums->del_bandwidth = 1;
           }
              $insert = array( 'member_id' => $ibforums->member['id'], 
                               'file_name' => $i['masked_file_name'],
                               'date'      => time(),
                               'size'      => filesize( $ibforums->vars['gallery_images_path'].'/'.$directory.$thumb.$i['masked_file_name'] )
                             );
              
              $DB->do_insert( 'gallery_bandwidth', $insert );
           }
       }        

 // Show an actual image url or serve through php?  
       if( $ibforums->vars['gallery_web_accessible'] == 'yes' )
       {
   return "<img src='{$ibforums->vars['gallery_images_url']}/{$directory}{$thumb}{$i['masked_file_name']}' {$attach} alt='{$thumb}{$i['masked_file_name']}' {$xy} />";	
       }
       else
       {
   return "<img src='{$ibforums->vars['board_url']}/index.php?act=module&module=gallery&cmd=viewimage&img={$i['masked_file_name']}&file_type={$i['file_type']}{$tn}{$dir}' {$attach} alt='{$thumb}{$i['masked_file_name']}' {$xy} />";
	 }

   }

   /**
    * make_image_link()
    * 
 * Generates a link to an image.  If $tn is set, then
 * it will generate a thumbnail tag.  Checks bandwith too
 * 
 * @version 1.2
 * @since 1.0
 * @access public
 * 
    * @param integer $id
    * @param integer $tn
    * @return string
    **/
   function make_image_link( $i, $tn=0, $override=0 )
   {
       global $ibforums, $DB;
       $show = true;
       
       if( $override )
       {
      	 $i['id'] = $override;
       }

       // Do we need to limit bandwidth useage?
       if( $ibforums->vars['gallery_detailed_bandwidth'] )
       {
           // Remove old entries
           if( ! $ibforums->bandwidth_purged )
           {
            $cut = time() - ( $ibforums->vars['gallery_bandwidth_period'] * 60 * 60 );
            $DB->simple_delete( 'gallery_bandwidth', "date < {$cut}" );
            $DB->simple_shutdown_exec();
            $ibforums->bandwidth_purged = true;
      	 }
           
           if( $ibforums->member['g_max_transfer'] )
           {
               $q = " SUM( size ) AS transfer, ";
           }

           if( $ibforums->member['g_max_views'] )
           {
               $q .= " COUNT( size ) AS views, ";
           }

           if( $q )
           {
               if( ! $ibforums->member['bandwidth'] )
               {
                   $q = preg_replace( "/(, )$/", "", $q );

                   $DB->simple_construct( array( 'select' => $q, 'from' => 'gallery_bandwidth', 'where' => "member_id={$ibforums->member['id']}" ) );
                   $DB->simple_exec();            

                   $ibforums->member['bandwidth'] = $DB->fetch_row();
               }

               if( ! empty( $ibforums->member['g_max_transfer'] ) && $ibforums->member['bandwidth']['transfer'] > $ibforums->member['g_max_transfer']*1024 )
               {
                   $show = false;
               }

               if( ! empty( $ibforums->member['g_max_views'] ) && $ibforums->member['bandwidth']['views'] > $ibforums->member['g_max_views'] )
               {
                   $show = false;
               }
           }
       }

       if( $show )
       {
           // Is this a multimedia thumbnail?
           if( $i['media'] )
           {
               // Do we already have the media info cached?
               if( ! $ibforums->media_thumb_cache )
               {
                   $DB->simple_construct( array( 'select' => '*', 'from' => 'gallery_media_types' ) );
                   $DB->simple_exec();

                   while( $j = $DB->fetch_row() )
                   {
                       $ibforums->media_thumb_cache[$j['extension']] = $j;
                   }
               }
               
               // What type of media do we have?
               $ext  = '.' . strtolower( array_pop( explode( ".", $i['masked_file_name'] ) ) );
               $media = $ibforums->media_thumb_cache[$ext];

               $thumbnail = "<img src='style_images/<#IMG_DIR#>/{$media['icon']}'>";

               return "<a href='{$ibforums->vars['board_url']}/index.php?act=module&module=gallery&cmd=si&img={$i['id']}'>{$thumbnail}</a>";
           }
           // Regular image
           else
           {
               return "<a href='{$ibforums->vars['board_url']}/index.php?act=module&module=gallery&cmd=si&img={$i['id']}'>".make_image_tag( $i, $tn )."</a>";
           }
       }
       else
       {
           return $ibforums->lang['bwlimit'];
       }
   }

   /**
    * make_name_link()
    * 
 * Generates a link to a user name
 * 
 * @version 1.0
 * @since 1.0
 * @access public
 * 
    * @param integer $id
    * @param string $name
    * @return string
    **/
   function make_name_link( $id, $name )
   {
       global $ibforums;
 
 if( $id > 0 )
 {
	 return "<a href='{$ibforums->base_url}act=module&module=gallery&cmd=user&user={$id}'>{$name}</a>";
 }
 else
 {
	 return $name;
 }
   }

   /**
    * check_perms()
    * 
 * Checks to see if the given group is found in the
 * given permission array
 * 
 * @version 1.0
 * @since 1.0
 * @access public
 * 
    * @param integer $group
    * @param array $perms
    * @return bool
    **/
   function check_perms( $group, $perms )
   {
       $chk = explode( ",", $perms );
       return in_array( $group, $chk );
   }
   
   /**
    * kb_to_byte()
    * 
 * Converts the size in KB to bytes
 * 
 * @version 1.0
 * @since 1.0
 * @access public
 * 
    * @param integer $kb
    * @return integer
    **/
   function kb_to_byte( $kb )
   {
       return $kb*1024;
   }

   /**
    * byte_to_kb()
    * 
 * Converts bytes to kilobytes, if $format is set, then
 * it will tack on the KB
 * 
 * @version 1.2
 * @since 1.0
 * @access public
 * 
    * @param integer $byte
    * @param integer $format
    * @return integer or string
    **/
   function byte_to_kb( $byte, $format=1 )
   {
  	 if( $format )
  	 {
     if( round( $byte/1024/1024, 2 ) > 1 )
     {
   $ret .= round( $byte/1024/1024, 2 ) . ' MB';
     }
     else
     {
    	 $ret  = round( $byte/1024, 2 ) . ' KB ';
     }      
  	 }
  	 else
  	 {
     $ret = round( $byte/1024, 2 );
  	 }
  	 
  	 return $ret;
   }

   /**
    * process_uploaded_file()
    * 
 * Moves the upload file to the images directory, checks all group settings,
 * does any required image manipulation
    *
 * @version 1.2
 * @since 1.1
 * @access public
    *
    * @param string $name
    * @param integer $create_thumb
    * @param integer $watermark
    * @param integer $container_id
    * @return array
    **/
   function process_uploaded_file( $name='', $create_thumb=1, $watermark, $containter_id=0 )
   {
       global $ibforums, $DB, $std, $print;
               
       // -------------------------------------------------------------
       // Image Details
       // -------------------------------------------------------------
       $file_name = $std->clean_value( $_FILES[$name]['name'] );
       $file_size = $_FILES[$name]['size'];
       $file_type = $_FILES[$name]['type'];
  	 $file_type = preg_replace( "/^(.+?);.*$/", "\\1", $file_type );
       $ext  = '.' . strtolower( array_pop( explode( ".", $file_name ) ) );   	 
         
       // -------------------------------------------------------------
       // Make sure we have a file
       // -------------------------------------------------------------
  	 if( ! $file_size )
  	 {
           $std->Error( array( 'LEVEL' => 1, 'MSG' => 'img_up_fail' ) );   	 
  	 }

       // -------------------------------------------------------------
       // Get Media Information
       // -------------------------------------------------------------
       $DB->simple_construct( array( "select" => '*', 'from' => 'gallery_media_types', 'where' => "extension LIKE '%{$ext}%'" ) );
       $DB->simple_exec();        

       // -------------------------------------------------------------
       // File Type Check
       // -------------------------------------------------------------
       if( $DB->get_num_rows() )
       {
           $tmedia = $DB->fetch_row();

           if( ! $tmedia['allowed'] )
           {
               $std->Error( array( 'LEVEL' => 1, 'MSG' => 'bad_file_type' ) );
           }
           
           $media = 0;
           if( ! $tmedia['default_type'] )
           {
          	 $media = 1;
           }            
       }
       else
  	 { 	 
           $std->Error( array( 'LEVEL' => 1, 'MSG' => 'bad_file_type' ) );
  	 }

       // -------------------------------------------------------------
       // Group Settings Check
       // -------------------------------------------------------------

       // Check max diskspace for this user
       if( $ibforums->member['g_max_diskspace'] )
       {
           $DB->simple_construct( array( 'select' => 'SUM( file_size ) as diskspace', 'from' => 'gallery_images', 'where' => "member_id={$ibforums->member['id']}" ) );
           $DB->simple_exec();
           $total = $DB->fetch_row();

           if( $total['diskspace'] + $file_size > kb_to_byte( $ibforums->member['g_max_diskspace'] ) )
           {
               $std->Error( array( 'LEVEL' => 1, 'MSG' => 'out_of_diskspace' ) );
           }
       }

       // Check max upload size for this user
       if( $media )
       {
       if( $ibforums->member['g_movie_size'] )
       {
           if( $file_size > kb_to_byte( $ibforums->member['g_movie_size'] ) )
            {
                $std->Error( array( 'LEVEL' => 1, 'MSG' => 'file_too_big' ) );
            }
        }        
       }
       else
       {
        if( $ibforums->member['g_max_upload'] )
        {
            if( $file_size > kb_to_byte( $ibforums->member['g_max_upload'] ) )
            {
                $std->Error( array( 'LEVEL' => 1, 'MSG' => 'file_too_big' ) );
            }
        }
  	 }

       // -------------------------------------------------------------
       // Figure out what directory we are gonna use
       // -------------------------------------------------------------
       $dir = "";
       if( $ibforums->vars['gallery_dir_images'] )
       {
           $DB->simple_construct( array( 'select' => 'directory', 
                                         'from'   => 'gallery_images', 
                                         'order'  => "id DESC",
                                         'limit'  => array( 0, 1 ) ) );
           $DB->simple_exec();            
           $dir = $DB->fetch_row();

           $dir = $dir['directory'];

           $DB->simple_construct( array( 'select' => 'COUNT(directory) AS files', 
                                         'from'   => 'gallery_images', 
                                         'where'  => "directory='{$dir}'" ) );
           $DB->simple_exec(); 

           $total = $DB->fetch_row();

           


            }

       // -------------------------------------------------------------
       // Generate a file name and attempt to copy to uploads directory
       // -------------------------------------------------------------
       $masked_name = "gallery_{$ibforums->member['id']}_{$containter_id}_".time()%$file_size.$ext;
       $masked_file = $ibforums->vars['gallery_images_path'].'/'.$dir.$masked_name;
       $img_load = array( 'out_dir'  => '/'.$dir,
                          'in_dir'   => '/'.$dir,
                          'in_file'  => $masked_name );

       if( ! move_uploaded_file( $_FILES[$name]['tmp_name'], $masked_file ) )
       {
           $std->Error( array( 'LEVEL' => 1, 'MSG' => 'img_up_fail' ) );
       }
       
       @chmod( $masked_file, 0777 );
       // -------------------------------------------------------------
       // Generate a thumbnail, if necessary
       // -------------------------------------------------------------
       if( ! $media )
       {
        $thumbnail = 0;
        if( $create_thumb )
        {
            $img_load['out_file'] = 'tn_' . $masked_name;
            $img = new Image( $img_load );
            if( $img->thumbnail( $ibforums->vars['gallery_thumb_width'], $ibforums->vars['gallery_thumb_height'] ) )
            {
                $img->write_to_file();
                $thumbnail = 1;
            }
            unset( $img );
        }

        // -------------------------------------------------------------
        // Resize the main image, if necessary
        // -------------------------------------------------------------
        if( $ibforums->vars['gallery_max_img_width'] || $ibforums->vars['gallery_max_img_height'] )
        {
            $img_load['out_file'] = $masked_name;
            $img = new Image( $img_load );

            if( $img->resize_proportional( $ibforums->vars['gallery_max_img_width'], $ibforums->vars['gallery_max_img_height'] ) )
            {
                $img->write_to_file();
            }
            unset( $img );
        }

        // -------------------------------------------------------------
        // Watermark the image, if necessary
        // -------------------------------------------------------------

        if( $watermark )
        {
            $img_load['out_file'] = $masked_name;
            $img = new Image( $img_load );
            if( $img->watermark() )
            {
                $img->write_to_file();
            }
            unset( $img );
        }

        // -------------------------------------------------------------
        // Need to do some gif handling if we are working with GD
        // -------------------------------------------------------------
        if( $ibforums->vars['gallery_img_suite'] != 'im' && $file_type == 'image/gif' )
        {
            $old_gif = $ibforums->vars['gallery_images_path'] . '/' . $dir . $masked_name;

            $file_type = 'image/jpeg';
            $file_name   = preg_replace( "/.gif/i", ".jpg", $file_name );
            $masked_name = preg_replace( "/.gif/i", ".jpg", $masked_name );
            $masked_file = preg_replace( "/.gif/i", ".jpg", $masked_file );

            $new_jpg = $ibforums->vars['gallery_images_path'] . '/' . $dir . $masked_name;
         
            gif_to_jpg( $old_gif, $new_jpg );
        }
 }

       return  array(  'file_name'         => $file_name,
                       'masked_file_name' => $masked_name,
                       'file_size'        => filesize( $masked_file ),
                       'file_type'        => $file_type,
                       'thumbnail'        => $thumbnail,
                       'media'            => $media,
                       'directory'        => str_replace( "/", "", $dir ),
                     );
   }

   function gif_to_jpg( $gif_file, $jpg_file )
   {
       $img = imagecreatefromgif( $gif_file );
       imagejpeg( $img, $jpg_file );
       imagedestroy( $img );

       unlink( $gif_file );
   }

  /**
   * build_sort_order_info()
   * 
   * Returns sort, order, prune keys, along with drop downs for each
* 
* @version 1.2
* @since 1.2
* @access public
   *
   * @param string $def_view
   * @return string
   **/
   function build_sort_order_info( $def_view='date:DESC:30' )
   {
       global $DB, $ibforums, $std, $print;

       // Build up the various arrays first
       $sort_check   = array( 'caption', 'name', 'date', 'views', 'comments' );
       $sort_options = array(
                              'caption'   => $ibforums->lang['sort_caption'],
                              'name'      => $ibforums->lang['sort_name'],
                              'date'      => $ibforums->lang['sort_date'],
                              'views'     => $ibforums->lang['sort_views'],
                              'comments'  => $ibforums->lang['sort_comments'],
                            );
       
       $order_options = array(
                               'ASC'  => $ibforums->lang['sort_asc'],
                               'DESC' => $ibforums->lang['sort_desc'],
                              );
       
       $prune_check   = array( 1, 5, 7, 10, 15, 20, 25, 30, 60, 90, '*' );
       $prune_options = array( 
                               '1'    => $ibforums->lang['sort_1'],
                               '5'    => $ibforums->lang['sort_5'],
                               '7'    => $ibforums->lang['sort_7'],
                               '10'    => $ibforums->lang['sort_10'],
                               '15'    => $ibforums->lang['sort_15'],
                               '20'    => $ibforums->lang['sort_20'],
                               '25'    => $ibforums->lang['sort_25'],
                               '30'    => $ibforums->lang['sort_30'],
                               '60'    => $ibforums->lang['sort_60'],
                               '90'    => $ibforums->lang['sort_90'],
                               '*'     => $ibforums->lang['sort_all'],
                             );
  
        // Figure out if the user has chosen a value, or if we should go with a default
        $views = explode( ":", $def_view );
        $sort_key  = ( $ibforums->input['sort_key'] )  ? $ibforums->input['sort_key']  : $views[0];
        $order_key = ( $ibforums->input['order_key'] ) ? $ibforums->input['order_key'] : $views[1];
        $prune_key = ( $ibforums->input['prune_key'] ) ? $ibforums->input['prune_key'] : $views[2];

        // Check it
        $order_key = ( $order_key == 'ASC' || $order_key == 'DESC' ) ? $order_key : 'DESC';
        $sort_key  = ( in_array( $sort_key, $sort_check ) )   ? $sort_key  : 'date';
        $prune_key = ( in_array( $prune_key, $prune_check ) ) ? $prune_key : '*';

        // Make up some sorting html
        $sort_key_html = "<select name='sort_key' class='forminput'>";
        foreach( $sort_options as $option => $name )
        {
            $sel = ( $option == $sort_key ) ? 'selected="selected"' : '';
            $sort_key_html .= "<option value='{$option}' {$sel}>{$name}</option>";
        }
        $sort_key_html .= "</select>";

        $order_key_html = "<select name='order_key' class='forminput'>";
        foreach( $order_options as $option => $name )
        {
            $sel = ( $option == $order_key ) ? 'selected="selected"' : '';
            $order_key_html .= "<option value='{$option}' {$sel}>{$name}</option>";
        }
        $order_key_html .= "</select>";

        $prune_key_html = "<select name='prune_key' class='forminput'>";
        foreach( $prune_options as $option => $name )
        {
            $sel = ( $option == $prune_key ) ? 'selected="selected"' : '';
            $prune_key_html .= "<option value='{$option}' {$sel}>{$name}</option>";
        }
        $prune_key_html .= "</select>";

        // Setup time pruning
        if( $prune_key != '*' )
        {
            $cut = $prune_key * 60 * 60 * 24;
            $prune = " AND date > {$cut}";
        }

        return array(
                      'SORT_KEY'       => $sort_key,
                      'ORDER_KEY'      => $order_key,
                      'PRUNE_KEY'      => $prune_key,
                      'SORT_KEY_HTML'  => $sort_key_html,
                      'ORDER_KEY_HTML' => $order_key_html,
                      'PRUNE_KEY_HTML' => $prune_key_html,
                    );
   }
   
   
?>

 

Посмотрите, админы, помогите, почему не создаются thumbnails, пишет после загрузки фото такую вещь:

 

IPB WARNING [2] Division by zero (Line: 684 of \modules\gallery\lib\image.php)
. Форум версии 2.0.4 зарегистрированный!
Ссылка на комментарий
Поделиться на других сайтах

  • 2 месяца спустя...
Надо чтоб галерея папки не создавала и всего делов. Надо наверно попросить хостера на 5 мин выключить сэйв муд и загрузить 1 форту. Дальше поставить кол-во фоток в диру максимальное. Чтоб новые не создавать.
Ссылка на комментарий
Поделиться на других сайтах

 

Есть ли здесь клиенты с доступом на invisionpower.com? Тогда просьба - посмотреть ссылку и рассказать, что там пишут :D

на форуме forums.invisionize.com все на неё ссылаются, а простым смертным доступ закрыт =)

Ссылка на комментарий
Поделиться на других сайтах

Присоединиться к обсуждению

Вы можете ответить сейчас, а зарегистрироваться позже. Если у вас уже есть аккаунт, войдите, чтобы ответить от своего имени.

Гость
Ответить в этой теме...

×   Вы вставили отформатированный текст.   Удалить форматирование

  Допустимо не более 75 смайлов.

×   Ваша ссылка была автоматически заменена на медиа-контент.   Отображать как ссылку

×   Ваши публикации восстановлены.   Очистить редактор

×   Вы не можете вставить изображения напрямую. Загрузите или вставьте изображения по ссылке.

Зарузка...
×
×
  • Создать...

Важная информация

Находясь на нашем сайте, вы соглашаетесь на использование файлов cookie, а также с нашим положением о конфиденциальности Политика конфиденциальности и пользовательским соглашением Условия использования.