<? function create_thumbnail( $source_file, $type, $end, $destination_file, $max_dimension) { $aspect_ratio = $img_width / $img_height; if ( ($img_width > $max_dimension) || ($img_height > $max_dimension) ) // If either dimension is too big... { if ( $img_width > $img_height ) // For wide images... { $new_width = $max_dimension; $new_height = $new_width / $aspect_ratio; } elseif ( $img_width < $img_height ) // For tall images... { $new_height = $max_dimension; $new_width = $new_height * $aspect_ratio; } elseif ( $img_width == $img_height ) // For square images... { $new_width = $max_dimension; $new_height = $max_dimension; } } else { $new_width = $img_width; $new_height = $img_height; } // If it's already smaller, don't change the size. // Make sure these are integers. $thumbnail = imagecreatetruecolor($new_width,$new_height); // Creates a new image in memory. // The following block retrieves the source file. It assumes the filename extensions match the file's format. { $img_source = imagecreatefromjpeg($source_file); } // Here we resample and create the new jpeg. imagecopyresampled($thumbnail, $img_source, 0, 0, 0, 0, $new_width, $new_height, $img_width, $img_height)or die("NIE"); // Finally, we destroy the two images in memory. imagedestroy($img_source); imagedestroy($thumbnail); } if($_POST['dodaj']=="Załącz zdjęcie") { $nr = 1;//numer pobierany z bazy $typ=$_FILES['src']['type']; create_thumbnail($_FILES['src']['tmp_name'],$_FILES['src']['name'],$nr.".".$rozszerz[1],"../../../../../../media/upload/",300); $_POST['url']=$nr.".".$rozszerz[1]; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>{#advanced_dlg.image_title}</title> <script type="text/javascript" src="../../tiny_mce_popup.js"></script> <script type="text/javascript" src="../../utils/mctabs.js"></script> <script type="text/javascript" src="../../utils/form_utils.js"></script> <script type="text/javascript" src="js/image.js"></script> <script type="text/javascript" src="ajax.js"></script> </head> <body id="image" style="display: none"> <form onsubmit="ImageDialog.update();return false;" action="#" method="POST" enctype="multipart/form-data"> <div class="tabs"> <ul> <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> </ul> </div> <? if($_POST['dodaj']!="Załącz zdjęcie"){ ?> <div class="panel_wrapper"> <div id="general_panel" class="panel current"> <table border="0" cellpadding="4" cellspacing="0"> <tr> <td class="nowrap"><label for="src">Wybierz plik</label></td> <td><table border="0" cellspacing="0" cellpadding="0"> <tr> <td><input id="src" name="src" type="file" class="mceFocus" value="" style="width: 200px" onchange="ImageDialog.getImageData();" /></td> <td > </td> </tr> </table></td> </tr> <script type="text/javascript"> //alert(document.getElementById('src').src); </script> <tr> <td></td> <td > <input type="submit" id="dodaj" name="dodaj" value="Załącz zdjęcie" /></td> </tr> </table> </div> </div> <?}else{?> <div class="panel_wrapper"> <div id="general_panel" class="panel current"> <table border="0" cellpadding="4" cellspacing="0"> <tr> <td colspan=2><table border="0" cellspacing="0" cellpadding="0"> <tr> <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> <td id="srcbrowsercontainer"> </td> </tr> </table></td> </tr> <tr> <td><label for="image_list">{#advanced_dlg.image_list}</label></td> <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> </tr> <tr> <td class="nowrap"><label for="alt">{#advanced_dlg.image_alt}</label></td> <td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td> </tr> <tr> <td class="nowrap"><label for="align">{#advanced_dlg.image_align}</label></td> <td><select id="align" name="align" onchange="ImageDialog.updateStyle();"> <option value="">{#not_set}</option> <option value="baseline">{#advanced_dlg.image_align_baseline}</option> <option value="top">{#advanced_dlg.image_align_top}</option> <option value="middle">{#advanced_dlg.image_align_middle}</option> <option value="bottom">{#advanced_dlg.image_align_bottom}</option> <option value="text-top">{#advanced_dlg.image_align_texttop}</option> <option value="text-bottom">{#advanced_dlg.image_align_textbottom}</option> <option value="left">{#advanced_dlg.image_align_left}</option> <option value="right">{#advanced_dlg.image_align_right}</option> </select></td> </tr> <tr> <td class="nowrap"><label for="width">{#advanced_dlg.image_dimensions}</label></td> <td><input id="width" name="width" type="text" value="" size="3" maxlength="5" /> x <input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td> </tr> <tr> <td class="nowrap"><label for="border">{#advanced_dlg.image_border}</label></td> <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td> </tr> <tr> <td class="nowrap"><label for="vspace">{#advanced_dlg.image_vspace}</label></td> <td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td> </tr> <tr> <td class="nowrap"><label for="hspace">{#advanced_dlg.image_hspace}</label></td> <td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td> </tr> </table> </div> </div> <?}?> <div class="mceActionPanel"> <div style="float: left"> <input type="submit" id="insert" name="insert" value="{#insert}" /> </div> <div style="float: right"> <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> </div> </div> </form> </body> </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

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

kolejny upek ... HELP
TEMAT DO ZAMKNIĘCIA. PROBLEM ROZWIĄZANY