Witam. Przedstawiam poniżej listing z pliku image.php odpowiedzialnego za pojawianie się okienka po wciśnięciu przycisku wstaw obrazek w edytorze TINYMCE. Jest on nieco zmodyfikowany (nie musicie go przerabiać tylko przeczytajcie to co jest na końcu):

  1. <?
  2.  
  3. function create_thumbnail( $source_file, $type, $end, $destination_file, $max_dimension)
  4. {
  5.   list($img_width,$img_height) = getimagesize($source_file); // Get the original dimentions
  6.   $aspect_ratio = $img_width / $img_height;
  7.    
  8.   if ( ($img_width > $max_dimension) || ($img_height > $max_dimension) ) // If either dimension is too big...
  9.   {
  10.       if ( $img_width > $img_height ) // For wide images...
  11.       {
  12.           $new_width = $max_dimension;
  13.           $new_height = $new_width / $aspect_ratio;
  14.       }
  15.       elseif ( $img_width < $img_height ) // For tall images...
  16.       {
  17.           $new_height = $max_dimension;
  18.           $new_width = $new_height * $aspect_ratio;
  19.       }
  20.       elseif ( $img_width == $img_height ) // For square images...
  21.       {
  22.           $new_width = $max_dimension;
  23.           $new_height = $max_dimension;
  24.       }
  25.       else { echo "Error reading image size."; return FALSE; }
  26.   }
  27.   else { $new_width = $img_width; $new_height = $img_height; } // If it's already smaller, don't change the size.
  28.  
  29.   // Make sure these are integers.
  30.   $new_width = intval($new_width);
  31.   $new_height = intval($new_height);
  32.  
  33.   $thumbnail = imagecreatetruecolor($new_width,$new_height); // Creates a new image in memory.
  34.  
  35.   // The following block retrieves the source file.  It assumes the filename extensions match the file's format.
  36.   if ( strpos($type,".gif") ) { $img_source = imagecreatefromgif($source_file); }
  37.   if ( (strpos($type,".jpg")) || (strpos($source_file,".jpeg")) )
  38.   { $img_source = imagecreatefromjpeg($source_file); }
  39.   if ( strpos($type,".bmp") ) { $img_source = imagecreatefromwbmp($source_file); }
  40.   if ( strpos($type,".png") ) { $img_source = imagecreatefrompng($source_file); }
  41.  
  42.    
  43.   // Here we resample and create the new jpeg.
  44.   imagecopyresampled($thumbnail, $img_source, 0, 0, 0, 0, $new_width, $new_height, $img_width, $img_height)or die("NIE");
  45.    
  46.   imagejpeg( $thumbnail, $destination_file.$end, 100 )or die("NIE");
  47.  
  48.   // Finally, we destroy the two images in memory.
  49.   imagedestroy($img_source);
  50.   imagedestroy($thumbnail);
  51. }
  52.  
  53. if($_POST['dodaj']=="Załącz zdjęcie")
  54. {
  55.    $nr = 1;//numer pobierany z bazy
  56.            
  57.    $typ=$_FILES['src']['type'];
  58.    $rozszerz = explode(".",$_FILES['src']['name']);
  59.    
  60.    create_thumbnail($_FILES['src']['tmp_name'],$_FILES['src']['name'],$nr.".".$rozszerz[1],"../../../../../../media/upload/",300);
  61.    
  62.    $_POST['url']=$nr.".".$rozszerz[1];
  63. }
  64. ?>
  65. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  66. <html xmlns="http://www.w3.org/1999/xhtml">
  67. <head>
  68.    <title>{#advanced_dlg.image_title}</title>
  69.    <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
  70.    <script type="text/javascript" src="../../utils/mctabs.js"></script>
  71.    <script type="text/javascript" src="../../utils/form_utils.js"></script>
  72.    <script type="text/javascript" src="js/image.js"></script>
  73.    
  74.    <script type="text/javascript" src="ajax.js"></script>
  75. </head>
  76. <body id="image" style="display: none">
  77. <form onsubmit="ImageDialog.update();return false;" action="#" method="POST" enctype="multipart/form-data">
  78.    <div class="tabs">
  79.        <ul>
  80.            <li id="general_tab" class="current"><span><a href="java script:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">Wstaw obrazek</a></span></li>
  81.        </ul>
  82.    </div>
  83. <?
  84. if($_POST['dodaj']!="Załącz zdjęcie"){
  85. ?>
  86.    <div class="panel_wrapper">
  87.        <div id="general_panel" class="panel current">
  88.     <table border="0" cellpadding="4" cellspacing="0">
  89.          <tr>
  90.            <td class="nowrap"><label for="src">Wybierz plik</label></td>
  91.            <td><table border="0" cellspacing="0" cellpadding="0">
  92.                <tr>
  93.                  <td><input id="src" name="src" type="file" class="mceFocus" value="" style="width: 200px" onchange="ImageDialog.getImageData();" /></td>
  94.                  <td > </td>
  95.                </tr>
  96.              </table></td>
  97.          </tr>
  98. <script type="text/javascript">
  99. //alert(document.getElementById('src').src);
  100. </script>
  101.             <tr>
  102.                 <td></td>
  103.                 <td >
  104.            <input type="submit" id="dodaj" name="dodaj" value="Załącz zdjęcie" /></td>
  105.             </tr>
  106.        </table>
  107.        </div>
  108.    </div>
  109.  
  110.    <?}else{?>
  111.  
  112.    <div class="panel_wrapper">
  113.        <div id="general_panel" class="panel current">
  114.     <table border="0" cellpadding="4" cellspacing="0">
  115.          <tr>
  116.            <td colspan=2><table border="0" cellspacing="0" cellpadding="0">
  117.                <tr>
  118.                  <td><input id="src" name="src" type="hidden" disabled class="mceFocus" value="http://biznes-klasa.pl/media/upload/<? echo $_POST['url'] ?>" style="width: 300px" onchange="ImageDialog.getImageData();" /></td>
  119.                  <td id="srcbrowsercontainer"> </td>
  120.                </tr>
  121.              </table></td>
  122.          </tr>
  123.          <tr>
  124.            <td><label for="image_list">{#advanced_dlg.image_list}</label></td>
  125.            <td><select id="image_list" name="image_list" onchange="document.getElementById('src').value=this.options[this.selectedIndex].value;document.getElementById('alt').value=this.options[this.selectedIndex].text;"></select></td>
  126.          </tr>
  127.          <tr>
  128.            <td class="nowrap"><label for="alt">{#advanced_dlg.image_alt}</label></td>
  129.            <td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td>
  130.          </tr>
  131.          <tr>
  132.            <td class="nowrap"><label for="align">{#advanced_dlg.image_align}</label></td>
  133.            <td><select id="align" name="align" onchange="ImageDialog.updateStyle();">
  134.                <option value="">{#not_set}</option>
  135.                <option value="baseline">{#advanced_dlg.image_align_baseline}</option>
  136.                <option value="top">{#advanced_dlg.image_align_top}</option>
  137.                <option value="middle">{#advanced_dlg.image_align_middle}</option>
  138.                <option value="bottom">{#advanced_dlg.image_align_bottom}</option>
  139.                <option value="text-top">{#advanced_dlg.image_align_texttop}</option>
  140.                <option value="text-bottom">{#advanced_dlg.image_align_textbottom}</option>
  141.                <option value="left">{#advanced_dlg.image_align_left}</option>
  142.                <option value="right">{#advanced_dlg.image_align_right}</option>
  143.              </select></td>
  144.          </tr>
  145.          <tr>
  146.            <td class="nowrap"><label for="width">{#advanced_dlg.image_dimensions}</label></td>
  147.            <td><input id="width" name="width" type="text" value="" size="3" maxlength="5" />
  148.              x
  149.              <input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td>
  150.          </tr>
  151.          <tr>
  152.            <td class="nowrap"><label for="border">{#advanced_dlg.image_border}</label></td>
  153.            <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
  154.          </tr>
  155.          <tr>
  156.            <td class="nowrap"><label for="vspace">{#advanced_dlg.image_vspace}</label></td>
  157.            <td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
  158.          </tr>
  159.          <tr>
  160.            <td class="nowrap"><label for="hspace">{#advanced_dlg.image_hspace}</label></td>
  161.            <td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
  162.          </tr>
  163.        </table>
  164.        </div>
  165.    </div>
  166.    
  167.    <?}?>
  168.    <div class="mceActionPanel">
  169.        <div style="float: left">
  170.            <input type="submit" id="insert" name="insert" value="{#insert}" />
  171.        </div>
  172.  
  173.        <div style="float: right">
  174.            <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
  175.        </div>
  176.    </div>
  177. </form>
  178. </body>
  179. </html>


Problem mam z odczytem czy okienko pojawia się po kliknieciu w dodane zdjęcie (zmiana istniejącego) czy też dodanie nowego zdjęcia. Potrzebuje wiedzy jak odczytać tę wlaśnie akcję. Przegrzebałem wsystkie skrypty tego edytora i poległem sad.gif. Może ktoś mi coś podopowiedzieć.

Aha ten skypt działa na takiej zasadzie. Klikamy w ikonke pojawia się okienko na którym mamy tylko pole typu "FILE". Więc wybieramy zdjęcie klikamy w przycisk załaduj zdjęcie i okienko przeładowuje się nam na te właściwe z opcjami takimi jak marginesy obramowanie wielkość obr. itp. Tylko jeżeli mam mieć edycję zdjęcia to chcę aby nie bylo tego pierwszego kroku czyli nie ma być wyboru zdjęcia tylko sama edycja jego parametrów. Da się tak zrobić ?

Tu link do umieszczonego edytora: http://michal-pietrasz.pl/edytor/

upek ... moze ktoś się skusi smile.gif

kolejny upek ... HELP


TEMAT DO ZAMKNIĘCIA. PROBLEM ROZWIĄZANY