Bachelor Thesis

  • Published on
    07-Apr-2016

  • View
    213

  • Download
    1

Embed Size (px)

DESCRIPTION

 

Transcript

<ul><li><p>OSTRAVSK UNIVERZITA V OSTRAV PRODOVDECK FAKULTA </p><p>KATEDRA INFORMATIKY A POTA </p><p>VYTVOEN NSTROJE PRO HROMADN NAHRVN RZNCH </p><p>SOUBOR V JAZYCE PHP </p><p>BAKALSK PRCE </p><p>Autor prce: Daniel Kilian Vedouc prce: RNDr. Bogdan Walek Ph.D. </p><p>2014 </p></li><li><p>UNIVERSITY OF OSTRAVA FACULTY OF SCIENCE </p><p>DEPARTMENT OF INFORMATICS AND COMPUTERS </p><p>CREATING TOOL FOR BULKLOADING VARIOUS FILES IN PHP </p><p> BACHELOR THESIS </p><p>Author: Daniel Kilian Supervisor: RNDr. Bogdan Walek Ph.D. </p><p>2014 </p></li><li><p>ESTN PROHLEN </p><p>J, ne podepsan student, tmto estn prohlauji, e text mnou odevzdan zvren </p><p>prce v psemn podob i na CD nosii je toton s textem zvren prce vloenm v </p><p>databzi DIPL2. </p><p>Ostrava dne </p><p>podpis studenta </p></li><li><p>ABSTRAKT </p><p>Tato bakalsk prce pojednv o hromadnm nahrvn rznch druh soubor na </p><p>webov strnky v jazyce PHP. V prvn sti tto prce se zamuji na analzu souasnch </p><p>nstroj, kter byly pro tento el vytvoeny. Kad z tchto nstroj nsledn osobn </p><p>vyzkoum a porovnm jejich funkce, monosti a vyuit. Nstroje budou pot porovnny </p><p>ve srovnvac tabulce. V dal fzi vyberu na zklad pedchozho srovnn nejlep </p><p>z danch nstroj a navrhnu nov komplexn nstroj, kter bude vyuvat monosti </p><p>hromadnho nahrvn rznch druh soubor pomoc dve vybranho nstroje a navc </p><p>usnadn uivatelm dal prci s nahranmi soubory, jako je trval zobrazovn nahranch </p><p>soubor, jejich pejmenovvn nebo nap. vytven galeri v ppad nahrvn fotografi. </p><p>Nakonec nov nstroj naimplementuji do komplexn webov aplikace a otestuji jeho </p><p>funknost v praxi na relnch webovch strnkch. </p><p>Klov slova: PHP, hromadn nahrvn soubor, analza, srovnn, nvrh, vytven </p><p>galeri, webov aplikace, testovn. </p><p>ABSTRACT </p><p>This bachelor thesis is about bulkloading various files on web pages using the PHP </p><p>language. In the first part of this thesis, I focus on analysis of currently existing tools which </p><p>were made for this purpose. I personally will try out each of these tools and compare their </p><p>functions, possibilities and usability and then will show them in a well arranged table. I </p><p>will choose the Best of these tools on the basis of the previous comparison and then design </p><p>a new complex tool which would be possible to upload multiple different files with, using </p><p>the previously chosen tool which will also additionally help users handle the uploaded files </p><p>in ways of permanent showing or renaming the files or creating galleries in the case of </p><p>uploading pictures. In the end I will implement the new tool in a complex web application </p><p>and test its function on a real website. </p><p>Keywords: PHP, bulkloading files, analysis, comparison, design, gallery making, web </p><p>application, testing. </p></li><li><p>Podkovn </p><p>Chtl bych podkovat RNDr. Bogdanu Walkovi, Ph.D. za jeho veden a rady, kter mi </p><p>velmi pomohly pi psan tto prce. </p><p>Tak bych chtl podkovat bratranci Zdekovi Kilianovi za zapjen jeho notebooku a </p><p>svm babikm za finann pomoc pi koupi novho, m mi umonili realizaci tto </p><p>prce. </p><p>Prohlauji, e pedloen prce je mm pvodnm autorskm dlem, kter jsem vypracoval </p><p>samostatn. Vekerou literaturu a dal zdroje, z nich jsem pi zpracovn erpal, v prci </p><p>dn cituji a jsou uvedeny v seznamu pouit literatury. </p><p>V Ostrav dne . . . . . . . . . . . . </p><p>. . . . . . . . . . . . . . . . . . </p><p>(podpis) </p></li><li><p>OBSAH </p><p>1 VOD .......................................................................................................................... 11 </p><p>1.1 PHP ....................................................................................................................... 11 </p><p>1.2 Upload ................................................................................................................... 12 </p><p>1.3 JavaScript .............................................................................................................. 13 </p><p>1.4 Flash ...................................................................................................................... 13 </p><p>1.5 AJAX..................................................................................................................... 13 </p><p>2 ANALZA SOUASNHOSTAVU ....................................................................... 14 </p><p>2.1 Uploadify............................................................................................................... 14 </p><p>2.2 Plupload................................................................................................................. 14 </p><p>2.3 Jupload .................................................................................................................. 15 </p><p>2.4 Drag and Drop ....................................................................................................... 16 </p><p>2.5 Blueimp ................................................................................................................. 17 </p><p>2.6 SWFUpload ........................................................................................................... 18 </p><p>2.7 Shrnut ................................................................................................................... 19 </p><p>3 CLE ............................................................................................................................ 20 </p><p>4 NVRH NSTROJE ................................................................................................ 21 </p><p>4.1 Sekvenn diagram ................................................................................................ 21 </p><p>4.2 Hlavn funkcionality navrhovanho nstroje ........................................................ 22 </p><p>4.2.1 Obrzky .......................................................................................................... 23 </p><p>4.2.2 Hudba a videa ................................................................................................ 24 </p><p>4.2.3 Dokumenty ..................................................................................................... 24 </p><p>4.2.4 Ostatn ............................................................................................................ 25 </p><p>4.3 Pedpokldan funknost webov aplikace .......................................................... 26 </p><p>4.4 Shrnut ................................................................................................................... 26 </p><p>5 IMPLEMENTACE NSTROJE.............................................................................. 27 </p><p>5.1 Pouit technologie ............................................................................................... 27 </p><p>5.2 Tdy a skripty aplikace ......................................................................................... 27 </p><p>5.2.1 Tda Uploads ................................................................................................ 27 </p><p>5.2.2 TdaSQLCommands ..................................................................................... 27 </p><p>5.2.3 GetInfo ........................................................................................................... 28 </p></li><li><p>5.2.4 Tda ShowData ............................................................................................. 28 </p><p>5.2.5 Uploadify ....................................................................................................... 28 </p><p>5.2.6 SetThumb ....................................................................................................... 28 </p><p>5.2.7 Tda PHPThumb [12] ................................................................................... 28 </p><p>5.2.8 Tda Mp3file [28] ......................................................................................... 29 </p><p>5.2.9 GetID3 [29] .................................................................................................... 29 </p><p>5.3 Webov aplikace ................................................................................................... 29 </p><p>5.4 Index ...................................................................................................................... 29 </p><p>5.5 Nahrvac strnky .................................................................................................. 30 </p><p>5.5.1 Ovldac panel ............................................................................................... 30 </p><p>5.5.1.1 Okno pro nastaven galerie ......................................................................... 31 </p><p>5.5.1.2 Okno pro zobrazen existujc galerie ........................................................ 31 </p><p>5.5.1.3 Formul pro nahrn soubor .................................................................... 32 </p><p>5.5.2 st pro nahran soubory .............................................................................. 32 </p><p>5.5.2.1 Ikona ........................................................................................................... 32 </p><p>5.5.2.2 Datov st ................................................................................................. 33 </p><p>5.5.2.3 Formul pro komente ............................................................................. 34 </p><p>5.6 Databze ................................................................................................................ 34 </p><p>5.6.1 Vysvtlen nzv ............................................................................................ 34 </p><p>5.6.2 Tabulky pro databzi ..................................................................................... 35 </p><p>5.7 Shrnut ................................................................................................................... 35 </p><p>6 OVEN VYTVOENHO NSTROJE ............................................................ 36 </p><p>6.1 Parametry webu ..................................................................................................... 36 </p><p>6.2 Nahrn a nastaven soubor ................................................................................. 36 </p><p>6.3 Testovn ............................................................................................................... 37 </p><p>6.3.1 Nahrvn soubor ......................................................................................... 37 </p><p>6.3.2 Nastaven galerie pro nahrvn .................................................................... 37 </p><p>6.3.3 Vybrn galerie k zobrazen ........................................................................... 37 </p><p>6.3.4 Manipulace se soubory .................................................................................. 37 </p><p>6.3.5 Pklad nahrvn ........................................................................................... 38 </p><p>6.4 Shrnut ................................................................................................................... 41 </p><p>ZVR ................................................................................................................................. 42 </p><p>SEZNAM POUIT LITERATURY .............................................................................. 43 </p></li><li><p>SEZNAM POUITCH SYMBOL .............................................................................. 47 </p><p>SEZNAM OBRZK ....................................................................................................... 49 </p><p>SEZNAM TABULEK ........................................................................................................ 50 </p><p>SEZNAM PLOH ............................................................................................................ 51 </p><p>PLOHA . 1 ................................................................................................................... 52 </p><p>PLOHA . 2 ................................................................................................................... 55 </p></li><li><p> 11 </p><p>1 VOD </p><p>Na vod bych Vs chtl seznmit s problematikou tmatu nahrvn soubor na internet a </p><p>s nkolika dleitmi pojmy, se ktermi se v prbhu tto prce budete setkvat. </p><p>Co se te hromadnho nahrvn soubor na web, tak k tomu dnes ji existuje spousta </p><p>nstroj, kter umouj i nahrvn rznch typ soubor. Nkter z nich maj i dal </p><p>nastaven, jako zobrazen nahranch soubor, nebo nastaven limit tkajcch se potu, </p><p>velikosti nebo typu soubor, kter lze nahrt. Nicmn po vlastnm vzkumu jsem zjistil, </p><p>e vtina z nstroj, kter jsem zkoumal, nem dnou dal monost prce s nahranmi </p><p>soubory, jako napklad jejich zobrazovn, pejmenovvn, mazn nebo tvorba celch </p><p>galeri. </p><p>Hlavn motivac tto prce je vytvoit komplexn nstroj pro nahrvn rznch typ </p><p>soubor bez jakchkoliv omezen. Tato omezen bude mon v ppad poteby upravit. </p><p>Dle m aplikace zajist, e se z nahranch soubor ihned vytvo kolekce (galerie), kter </p><p>se pehledn zobraz uivateli na obrazovce. Kad nahrvac strnka bude mt v hlavice </p><p>ovldac panel, kter umon uivateli jednodue manipulovat se soubory ve smyslu </p><p>pejmenovvn, mazn, upravovn popisu nebo pesouvn mezi galeriemi. Uivatel </p><p>bude mt monost vytvet galerie dle vlastnho uven. </p><p>V prvn sti prce provedu analzu souasnch nstroj a pot je porovnm ve form </p><p>tabulky. V dal sti provedu nvrh aplikace. Pot zanu s vytvenm nstroje a webov </p><p>aplikace a implementac navrhnutch funkc. Nakonec provedu test vytvoenho nstroje </p><p>na skutenm webu. </p><p>1.1 PHP </p><p>Asi tm nejdleitjm pojmem, se kterm se v tto prci setkte, je PHP (PHP: Hypertext </p><p>Preprocessor). PHP vzniklo v roce 1996 a pvodn znamenalo PersonalHomePage [2], od </p><p>t doby prolo mnoha zmnami. Je to skriptovac programovac jazyk pracujc na stran </p><p>serveru, co znamen, e veker procesy funkc a vpoty probhaj na serveru, kde jsou </p><p>uloeny vechny zdrojov kdy. Zde se po pijet poadavku od uivatele spust dan </p><p>skript, kter vygeneruje HTML strnku, a vrt ji zpt uivateli, kter tm pdem vid </p><p>pouze vsledek vechny procesy a postupy napsan autorem kdu jsou skryty [1]. </p></li><li><p> 12 </p><p>Jazyk PHP pouv dynamick typovn nen nutn uvdt datov typy ani deklaraci </p><p>promnnch, m dochz k zobecnn kdu a zrove se zv i jeho flexibilita. Na </p><p>druhou stranu si mus programtor dvat vt pozor pi psan kdu, nebo kontrola </p><p>dynamickho typovn probh a za bhu programu, take bv t odhalit ppadn </p><p>chyby. </p><p>Aktuln pouvan verze PHP je PHP5. Jej nejvt vhodou oproti starm verzm je ta, </p><p>e vyuv model objektov orientovanho programovn zaloen na takzvanm </p><p>Zendengine 2 [1]. </p><p>Mezi dal vhody PHP5 pat: </p><p> lep podpora MySQL, </p><p> vestavn podpora pro SQLite, </p><p> innj kontrola chyb umoujc vyhazovn vjimek, </p><p> monost vyuvn jmennch prostor (namespace), </p><p> zkrcen podmnn vrazy, </p><p> nov funkce a pkazy [3]. </p><p>1.2 Upload </p><p>Nahrvn (upload) rznch druh soubor na webov strnky je v dnen dob velice </p><p>dleitm aspektem webovch strnek. Jednm ze zpsob nahrvn soubor je monost </p><p>pout jazyk PHP. asto je ale nutn nahrt vce soubor najednou a prv toho se d </p><p>doclit kombinac jazyka PHP a njakho nstroje. Nahrvn mnoha soubor najednou je </p><p>nezbytn funkce napklad pi vytven online galerie obrzk. Dky souasnm </p><p>nstrojm a PHP lze jednodue vybrat vechny potebn soubory najednou, nebo dokonce </p><p>cel sloky, jejich obsah chcete nahrt a uetit si tak ohromn mnostv asu, kter by </p><p>jinak zabralo jednotliv vybrn soubor. </p><p>Nstroje pro nahrvn jsou zaloeny pevn na technologich JQuery nebo Flash, kter </p><p>budou popsny dle v textu. </p></li><li><p> 13 </p><p>1.3 JavaScript </p><p>JavaScript je skriptovac jazyk, kter je mono vkldat do webovch strnek. Nekompiluje </p><p>se a ne vechny skripty funguj ve vech prohlech. Mezi vyuit JavaScriptu pat </p><p>tvorba dynamickch webovch strnek, lze vytvet rzn animace, slid...</p></li></ul>