View Full Version : How to read xml file using PHP
mignoncharly
06-03-2016, 10:32 AM
Hello,
my question may be seems simple but what i really meant is that i have unzipped a pptx file and i m trying to read the xml using php ... here is my code .
i just got a "done (unzipped succeeded)" output and nothing else
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
// the string variable that will hold the file content
$file_content = "";
// open file
$file_path = './Reports/report.pptx';
$target_folder_path = './Reports/';
$zip = new ZipArchive;
$res = $zip->open($file_path);
if ($res === TRUE) {
$zip->extractTo($target_folder_path);
//$zip->close();
echo 'done <br>';
// loop through all slide#.xml files
$slide = 1;
while ( ($index = $zip -> locateName("./Reports/ppt/slides/" . $slide . ".xml")) !== false ){
$data = $zip -> getFromIndex($index);
$xml = DOMDocument::loadXML($data, LIBXML_NOENT | LIBXML_XINCLUDE | LIBXML_NOERROR | LIBXML_NOWARNING);
$file_content .= strip_tags($xml -> saveXML());
$slide++;
}
$zip->close();
} else {
echo 'failed';
}
echo $file_content;
//var_dump($file_content);
?>
Thanks in advance
Karl
jscheuer1
06-03-2016, 04:56 PM
First thing I would try is to make sure these files are actually there in the output folder, like:
./Reports/ppt/slides/1.xml
Or maybe that's the problem. From the comment (// loop through all slide#.xml files) you are looking for like:
./Reports/ppt/slides/slide1.xml
But the code is only looking for ./Reports/ppt/slides/1.xml
If that's not the problem, make sure those files are there.
If all that checks out, I see that you seem to be trying to extract each xml file again in order to process it (from within the loop):
$data = $zip -> getFromIndex($index);
Instead, try using the actual already extracted file (whatever you use, $data must now be a valid xml string):
$data = file_get_contents("./Reports/ppt/slides/" . $slide . ".xml");
If still not working do some checking to see that the loop is actually proceeding, like put something in there that will echo the filename each time the loop executes:
echo "./Reports/ppt/slides/" . $slide . ".xml";
If it's not executing AND the files are there AND they are named correctly/as expected, then this needs work:
while ( ($index = $zip -> locateName("./Reports/ppt/slides/" . $slide . ".xml")) !== false )
Try looping on the actual folder, like maybe using glob to get the actual files.
jscheuer1
06-03-2016, 07:12 PM
OK, I got this working in a mock up locally. This line looks to be the trouble:
while ( ($index = $zip -> locateName("./Reports/ppt/slides/" . $slide . ".xml")) !== false ){
The path ("./Reports/ppt/slides/") and filename ($slide . ".xml") are crucial. They must be relative and accurate to the structure of the .zip file - NOT to that of the output folder. In my mock up I had a zip that had 1.xml and 2.xml in the .zip file. The output folder was 'output' but that's immaterial unless we want to go after the actual extracted files. Using the methodology already in your code we can simply go after the $zip object. But we must do so using it's structure. ./ means nothing, and causes a problem. If we want to start from the root of the zip file, use nothing to indicate that. Next comes the path (if any) and the filename within the zip archive. To be absolutely certain of what that is, look at the archive using a utility or other method that shows its internal path structure.
That all said, working with glob and the actual output, as I mentioned before would also work.
If you want more help, attach or give me a location I can download your zip archive from.
mignoncharly
06-04-2016, 11:39 AM
Hi John,
thank for your response.
there was a typo on this line
$data = file_get_contents("./Reports/ppt/slides/" . $slide . ".xml");
instead for $data = file_get_contents("./Reports/ppt/slides/slide" . $slide . ".xml");
however it still doesnt do anything => blank page
ich made some changes and i got donefailed ???
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
// the string variable that will hold the file content
$file_content = "";
// open file
$file_path = 'Reports/report.pptx';
$zip = new ZipArchive;
$res = $zip->open($file_path);
if ($res === TRUE) {
$zip->extractTo('Reports');
echo 'done';
// loop through all slide#.xml files
$slide = 1;
while ( ($index = $zip -> locateName("Reports/ppt/slides/slide" . $slide . ".xml")) !== false ){
//echo "./Reports/ppt/slides/slide" . $slide . ".xml";
$data = $zip -> getFromIndex($index);
$xml = DOMDocument::loadXML($data, LIBXML_NOENT | LIBXML_XINCLUDE | LIBXML_NOERROR | LIBXML_NOWARNING);
$file_content .= strip_tags($xml -> saveXML());
$slide++;
}
$zip->close();
echo 'failed';
}
echo $file_content;
?>
Karl
mignoncharly
06-04-2016, 11:48 AM
Hi,
you can any pptx file of your choice
Thks in advance
Karl
jscheuer1
06-04-2016, 02:29 PM
OK, There could also still be other problems, but you took away too much ./
By way of explanation, you don't really have to extract anything, but if you do, the path must be correct, and the path to the archive must be correct in any case. It is only the path inside the archive used by locateName that must reflect only the actual structure of the archive and not use the ./ or any local folders. So this should work assuming the pptx file is in the Reports folder off of the current working folder:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
// the string variable that will hold the file content
$file_content = "";
// open file
$file_path = './Reports/report.pptx'; // must be a valid pptx file with path relative to this script's working folder
$zip = new ZipArchive;
$res = $zip->open($file_path);
if ($res === TRUE) {
$zip->extractTo('./Reports/'); // not required, but if used, must be a valid local path, only needed if you want to have the files extracted
echo 'done<br>'; // this means we successfully opened the zip for processing
// loop through all slide#.xml files
$slide = 1;
while ( ($index = $zip -> locateName("ppt/slides/slide" . $slide . ".xml")) !== false ){ // must represent the internal structure of the archive - no local paths allowed
$data = $zip -> getFromIndex($index);
$xml = DOMDocument::loadXML($data, LIBXML_NOENT | LIBXML_XINCLUDE | LIBXML_NOERROR | LIBXML_NOWARNING);
$file_content .= strip_tags($xml -> saveXML());
$slide++;
}
$zip->close();
} else {
echo 'failed'; // this means we failed to open any archive
}
echo $file_content;
?>
mignoncharly
06-04-2016, 09:02 PM
Hey John,
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
// the string variable that will hold the file content
$file_content = "";
// open file
$file_path = './Reports/report.pptx'; // must be a valid pptx file with path relative to this script's working folder
$zip = new ZipArchive;
$res = $zip->open($file_path);
if ($res === TRUE) {
$zip->extractTo('./Reports/'); // not required, but if used, must be a valid local path, only needed if you want to have the files extracted
echo 'done<br>'; // this means we successfully opened the zip for processing
// loop through all slide#.xml files
$slide = 1;
while ( ($index = $zip -> locateName("ppt/slides/slide" . $slide . ".xml")) !== false ){ // must represent the internal structure of the archive - no local paths allowed
$data = $zip -> getFromIndex($index);
$xml= new DOMDocument();
$xml->loadXML($data, LIBXML_NOENT | LIBXML_XINCLUDE | LIBXML_NOERROR | LIBXML_NOWARNING);
$file_content .= strip_tags($xml -> saveXML());
$slide++;
}
$zip->close();
} else {
echo 'failed'; // this means we failed to open any archive
}
echo $file_content;
?>
now it works fine but can you help me to display those information properly?
jscheuer1
06-04-2016, 10:50 PM
now it works fine but can you help me to display those information properly?
"properly" is a relative term. I don't even know what data is in your file(s), let alone how you want it displayed.
That said, the xml tags within the xml files we have just extracted and read probably provide a clue as to what each piece of data represents. It's entirely possible to get the tag names and use them as table headers. But that might not be what you want. Alternatively, one can introduce line breaks at strategic points. It's possible that might accomplish what you're after. There well may be other possibilities.
In any case, if I could see a typical report.pptx file of the kind you are working with, that would help me get an idea of how best to present the data. But, even so, you are the one who needs to describe the optimal output format.
For instance, if you could take the output from our current working version and show or describe how you would like to see that being displayed - that might be all I need to know.
As you can see though, it's pretty vague to just say, "display those information properly".
Again, can you supply a typical file and/or describe what "properly" means to you in a more specific manner?
mignoncharly
06-05-2016, 09:49 AM
Hi John,
the document is confidential but its about a report on company's progression with images. So iwanted to know if there is apossibility to extract all these info through xml and parse it in a pdf file using i.e fpdf library.
Karl
Beverleyh
06-05-2016, 11:21 AM
This blog post might help you extract and manipulate xml data into an HTML page - you can then be your own judge and creator of how to display something "properly" http://www.dynamicdrive.com/forums/entry.php?325-XML-to-HTML-Getting-XML-Data-into-a-Web-Page-with-SimpleXML
From there, you might be able to use an HTML to PDF converter https://www.sitepoint.com/convert-html-to-pdf-with-dompdf/
jscheuer1
06-05-2016, 01:34 PM
You can convert directly from pptx to pdf for free on the web, or just use Open Office or Office to do it yourself:
https://www.google.com/search?q=convert+pptx+to+pdf
That said, we can probably save the information we have just extracted to a pdf, that still leaves the issue of how that should be formatted. You don't have to release any private info. Just take an example file, use it's output from the code we have so far, and change that into something pretend. Then show how you would like that displayed.
Or, if you're happy with how it looks and just want it as a pdf, we can just dump it into a pdf.
mignoncharly
06-05-2016, 02:59 PM
Hi John,
sure i tried with some example file and the information have been displayed like a mess
unfortunately i cant use a web service for that i have to do it progamaticaly with xml and php
i also think that may be its not possible at all because they are info that would be missed as images
because when unzipped there are in many others files
jscheuer1
06-05-2016, 07:49 PM
Well OK, there usually are images in pptx files, but unless they are required, you don't need them. If they are required, they can be found in the archive and put into a .pdf file. The tricky part would be in determining where in the pdf file they should go. That information is probably available (hopefully in the slides, but might be elsewhere in the pptx archive), how else would the pptx file know where to put the images?
Anyways, I have worked something out for a text only pdf from the slides of a pptx file using the fpdf library:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
// open file
$file_path = 'Reports/report.pptx';
//$target_folder_path = 'Reports';
$zip = new ZipArchive;
$res = $zip->open($file_path);
if ($res === TRUE) {
// $zip->extractTo($target_folder_path);
require('../../../fpdf181/fpdf.php'); //path to fpdf.php on your server
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',10);
$headings = Array();
// loop through all slide#.xml files
$slide = 1;
while ( ($index = $zip -> locateName("ppt/slides/slide" . $slide . ".xml")) !== false ){
$pdf->Cell(40,7,"Report #$slide:",0,1);
$data = $zip -> getFromIndex($index);
$p = xml_parser_create();
xml_parse_into_struct($p, $data, $vals);
xml_parser_free($p);
$str = '';
foreach($vals as $val){
if(isset($val['value'])){
$str .= chop($val['value']) . " ";
}
}
if(strlen($str)){
$parts = explode(" ", $str);
$tmpstr = "";
foreach($parts as $part){
$apart = chop($part)? chop($part) . " " : "";
$tmpstr .= $apart;
if(strlen($tmpstr) < 113){
$pstr = $tmpstr;
} else {
$pdf->Cell(0,4,$pstr,0,1);
$tmpstr = $apart;
}
}
if(strlen($tmpstr)){
$pdf->Cell(0,4,$tmpstr,0,1);
}
$pdf->Cell(0,3,'',0,1);
}
$slide++;
}
$zip->close();
$pdf->Output();
} else {
echo 'failed';
}
?>
Use fpdf from: http://www.fpdf.org/en/download.php (version 1.81)
mignoncharly
06-06-2016, 06:08 AM
Hi Beverleyh,
thank you for the links i think they will help me though.
mignoncharly
06-06-2016, 07:52 PM
Hi John,
Thanks for your reply ... it works fine except the fact that each slide has been output
the images are located in Reports/ppt/media but as you said
"how else would the pptx file know where to put the images?" that is the question ... ;)
and its a little complicated as far slides have different structure
i remembered that this document is for public displays so i can share it with you so you
see how it looks like
for the first 3 slides we have this kind of "header" but the "footer" seems to be the same
jscheuer1
06-07-2016, 04:41 AM
This (pptx) is all fairly new to me. I've heard of it before, had a general idea what it was, but never actually worked with it or anything related to it before. In fact, I'd never even looked at power point presentation before. XML, PHP, and PDF, on the other hand, those I know a fair amount about, and am therefore able to learn new details on those fairly easily.
I've been looking at some more xml slide files. I don't see where the images are specified. I may have missed something though, or maybe that information is stored somewhere else in the pptx file. It has to be there. It's like a black hole (or at least no more complicated than one). Information must be conserved (Hawking).
So you say these files can be shared after all? I would probably only need one fairly typical one to enhance my chances of finding an optimal solution for your particular situation. That's because, so far - I've discovered that each pptx can make specific uses of images, not each pptx file uses images in the same ways. If we can discover a pattern for how your particular pptx files use images, that might be useful.
That said, as I look more at the structure of pptx in general, I'm likely to discover a generic solution. I'm also thinking - someone must have already done this. Or at least mapped where each significant bit of information is stored in these files. By the end of the week I'll probably have more on that front.
mignoncharly
06-07-2016, 05:31 AM
Hi John,
It's much appreciated the way you take your time and energy to answer.
When unzipping the files don't you have any "media" folder!?
OK I'll also continue working on it. Thank you
Best Regards
Charles
jscheuer1
06-07-2016, 05:56 AM
Yes, I know - have seen the media folder (as far as I can tell at the moment - only contains images - no info on how said images are to be deployed, especially visa vis the positioning of text upon them, which I also have found can be erratic at times even internally to a pptx file - but, if one and only one image per slide, that's helpful/easy to deal with to an extent). I will be looking into that and any other clues as to how best to go about this. But, since you seem to be willing to link to or attach one of your files, that would probably also be helpful. These files can have subtle differences like encoding, and general organizational approaches. Being able to see a typical one of the sort you are dealing with would probably be a good thing - that is, if I understood correctly and it is OK for you to share one publicly.
If not, I can probably arrange for a way for you to get one of your pptx files to me privately.
mignoncharly
06-07-2016, 06:21 AM
Hi,
OK
how can I attach the file here ... I can't share it via dropbox on this machine(technically problem may be) ... may be the private way will be the best one :)
Charles
jscheuer1
06-07-2016, 06:33 AM
I'll PM you my email address. You can attach the file there. Or to a PM response, your choice.
mignoncharly
06-07-2016, 06:47 AM
Hi,
sent
Charles
jscheuer1
06-08-2016, 03:03 AM
OK, as you know I got the file. I've been looking at it and into the pptx specifications. Not looking great. Your example file shows a level of sophistication in the use of both images (not necessarily using one image per slide, also using non-web-standard image formats) and drawing (yes pptx files can also have drawings rendered via commands to put a line or shape one place or another upon or near an existing image). Your file uses all these techniques and perhaps more, making reading them out to PDF more difficult than I had at first imagined. That doesn't mean it cannot be done. But let me put it this way, (paraphrasing information I came across researching the standard) - The pptx standard is the result of at least thousands of hours of work over 10 or more years involving hundreds or more programmers. So to easily convert it fully to PDF in the manner we've been using would be quite a task. I found some folks who claim to have found decent workarounds. These involve using one or another document API. The two that so far look most promising are PUNO (Open Office API), and the Google Docs API. Both should be able to convert from many formats (including pptx) to many others (including PDF). However they require connecting live on the web to the given API during the conversion process and may also require one or more other modules to PHP (like ZEND, for example), all of which is likely doable unless you are prevented from adding needed modules, and/or must do this exclusively on an intranet that has no access to the web.
mignoncharly
06-08-2016, 06:14 AM
Hi John,
thank you.
ok. I have tried this way because the others possibilities were not accessible
1) as you said "unless you are prevented from adding needed modules, and/or must do this exclusively on an Intranet that has no access to the web. " its exactly that
2)I shouldn't use the class COM from PHP because it involves Microsoft Office or Open Office (for security reasons)
3)pptx into images was my first attempt and the struggle was real
4)now I was trying my last chance doing this: pptx -> unzip -> xml -> pdf (may be -> png)
5)I think i'll give up so far as every software that does this conversion is not free and very expensive for a server purpose.
Anyway ... thank you for your help
Charles
jscheuer1
06-08-2016, 08:12 PM
What I would be inclined to do in that case is either:
1.) Just have them download and view the pptx file locally.
or:
2.) Convert them all to PDF using MO or OO (free if you don't have MO). You can probably setup a batch file to do all of them at once if there are - say more than ten. Then simply make the PDF files available, or even give the users the choice of format for download. Of course, in the case of PDF, they can always choose to simply view it in the browser (like all PDF viewed that way, it gets downloaded to the browser's cache anyway though).
mignoncharly
06-09-2016, 06:32 AM
Hi John,
1.) Actually the files will be uploaded in a directory on the server and fetched (by a script / code) from there for the conversion. And the goal is to broadcast them in the form of pdf or images or video on public displays.
2.) Convert them all to PDF using MO or OO. => No I shouldn't as explained in my last reply.
Charles
jscheuer1
06-09-2016, 07:52 PM
#2 Why not just do it? I mean don't have a web and/or intranet available routine for that, just do it manually or via a batch file that only you control/have access to. No security violation there.
mignoncharly
06-10-2016, 07:19 AM
This has already been done using asp .net but now I wanted to do it programmatically using php so no need for manual intervention
jscheuer1
06-10-2016, 03:21 PM
Where did you find out about the asp.net approach? And does it use MO or another program, or is it a straight conversion like we were attempting in PHP? I would imagine that .net might have the data structures directly available to it and/or be extremely well suited to running MO from a shell.
mignoncharly
06-12-2016, 11:23 AM
Hi,
" ... .net might have the data structures directly available to it and/or be extremely well suited to running MO from a shell." exactly but with a batch file. the work has been done by another teammate. now we wanted to use only php.
John I have found a software for the conversion now my problem is: could you propose me some method / tricks to use the .exe using php ? i was thinking about these steps:
1) a function that pushes the pptx files in new array and
2) a loop throught the array to fetch the 1.pptx and convert it
what do you think?
Thks in advance
Charles
jscheuer1
06-12-2016, 04:10 PM
The glob function can do that (1, make the array), and foreach can loop (2) through it:
foreach (glob("*.pptx") as $filename) {
if($filename === "1.pptx"){convert($filename);}
}
But if you are only doing that to choose the 1.pptx file, you can simply go after it directly:
convert("1.pptx");
BTW, what software did you find?
mignoncharly
06-12-2016, 05:48 PM
Hi,
ok thanks ... no there will be different files i.e.
$filespptx = array($file1, $file2, ... $filen);
and every time afile wil be push into the array it wiöö be compared to the earlier if != then will be fetched and sent to the conversion
okdo converter professionnal => software
jscheuer1
06-12-2016, 06:24 PM
OK, you're modifying what you asked, though maybe you didn't realize how vague your question was. You just said 1.pptx as if that were all you wanted. With this new information, I think I would go for glob after all. It can get all the files of a certain extension (*.pptx in this case) that reside in a particular folder. Then I take it you want to compare those against the ones that have already been converted (glob again, but this time on *.pdf). Assuming the filename is always constant and unique and that only filenames which have already been converted will have both the pptx and pdf extensions, something can be worked out. Is that the situation though? Before I write the actual code, I'd like to know if we both know and agree upon what it's supposed to do.
Ah, but the page for the program (OKDO) you're using lists as its first feature:
"Batch convert any format file once to save your time."
That implies (though doesn't guarantee) it will skip already converted files - something to look into.
mignoncharly
06-12-2016, 09:24 PM
Ok. What i meant is: the pptx files are in a directory and the code takes each file and converts (using okdo ---i don't know how to call the .exe for the conversion--) it into png(not into pdf anymore because okdo does all) and save them in a (new) directory.
Then this png files will be then output on a browser like a slideshow.
Charles
jscheuer1
06-12-2016, 10:53 PM
OK, glad I waited. This still doesn't make complete sense to me, though generally I'm pretty sure it can be worked out.
The biggest issue to me is: "i don't know how to call the .exe for the conversion"
I'm thinking either com or exec would work, unless for some reason (shared host, perhaps something else) those are not available to you. If they are, it's just a matter of finding the correct syntax.
In any case, that's up to you, the OKDO folks and/or your host might be able to help there, but it's a fact (as far as I know at this point) that, unless you have permission to run an executable on your server, you can't. I've run into that already and have been thinking of upgrading or at least side grading (giving up some features in return for being able to run executables) my contract with my host so I can do neat things like that. I'm just not sure right now how important that is to me. For your plan, it seems essential. Unless there is some other way.
OK, so let's say that gets worked out. I'm also seeing a confusion? Some sort of issue with: "into png (not into pdf anymore because okdo does all) and save them in a (new) directory. Then this png files will be then output on a browser like a slideshow"
In my mind the reason why PDF was good is that an entire pptx can become an entire pdf. One could then page through the pdf in a similar fashion as one could with the pptx. With png, you could also do that (convert one to one), but it would be one giant image, not a slideshow, nor even anything one could page through. So, I guess it would have to be one .png per slide, right? As long as OKDO or whatever is used can do that, that's fine and a slideshow (probably partially run/facilitated with javascript) could handle all that nicely on the presentational side.
So, I guess my big question is, how were you planning on getting OKDO to run on the server? Do you even have a general idea? And I'd also like to know - Does my idea about the slideshow sound compatible with what you were thinking?
mignoncharly
06-13-2016, 06:02 AM
Hi,
1) exec would work
2) i have permission to run an executable on the server
3) if you think that 1 PPTX file into an entire PDF is better then we could do so
4) yes i meant one .png per slide and for the slideshow (its clear) i can also write a javascript function for the presentational side.
5) "how were you planning on getting OKDO to run on the server?" i'm going to install it on the server ...
$path= "c:/inetpub/wwwroot/okdo.exe";
exec ($path,$output, $return);
6) now ... how can i use the syntax above to execute each PPTX?
i hope this time i have been clear (sorry english isn't my first language)
Charles
jscheuer1
06-14-2016, 09:07 PM
I still have more questions. I may end up getting the free trial version of OKDO just to see if I can work this out, which I'm pretty sure I can.
What I'm wondering though is, say you convert pptx to png, does it automatically make one png for each slide, or does it make one png that represents the entire pptx? Can you/do you have to unzip the pptx and then convert each ppt/slide/slide#.xml file? That's if we're still going png.
If we are committed to going pdf, then it's not an issue, should be a one to one conversion. I'm willing to try both.
I guess my main question is, have you tried out either or both of these conversions manually using OKDO, and, if so, how did they each work?
mignoncharly
06-15-2016, 06:13 AM
Hi,
"you convert pptx to png, does it automatically make one png for each slide, or does it make one png that represents the entire pptx?" => yes it converts automatically 1 png for each slide.
"Can you/do you have to unzip the pptx and then convert each ppt/slide/slide#.xml file? " => No i don't need to unzip the pptx anymore because i'm not going to use xml
"If we are committed to going pdf, then it's not an issue, should be a one to one conversion." => As i said into png will be better but if you are with ease with pdf then its ok.
"I guess my main question is, have you tried out either or both of these conversions manually using OKDO, and, if so, how did they each work" => Yes i have tried and the images are save in a "Output" directory. I didn't remember about pdf output but for png it was 1 png for each slide (report.pptx has 4 slides and after the conversion i got 4 images(.png) )
jscheuer1
06-15-2016, 04:29 PM
I think we're almost there. Can you control the name of the output folder? Like, take the name of the pptx file and have - say for report.pptx, a reportOuput folder. If there's more than one file named report.pptx we could number them.
And what happens to the files later? Do you end up deleting the pptx file? If not, is it moved somewhere? What happens to the png files, are they kept?
We can work all that and any other details (anything you might think of that needs to happen) out later once you answer. But in simplest terms, this is what I think will be good:
<?php
exec('whatever to outputfoler');
$pngs = glob('outputfoler/*.png');
$front = '<img src="';
$back = "\" alt=\"\" />\n";
$middle = implode("$back$front", $pngs);
echo "$front$middle$back";
?>
You can then run the slideshow of your choice on the resulting images.
mignoncharly
06-16-2016, 06:16 AM
"I think we're almost there. Can you control the name of the output folder? " => No the Output folder is automatically generate and the png inside are numbered.
"And what happens to the files later? Do you end up deleting the pptx file?" => No
"If not, is it moved somewhere?" => No
" What happens to the png files, are they kept?" => Yes
jscheuer1
06-16-2016, 03:56 PM
If that's the case, you are going to possibly have a lot of files lying around, and maybe a hard time telling which is which.
Let's see if I'm following what you have/want:
1) Someone uploads a pptx file - you would have to have the name from the form and script that processes the upload. If the file already exists in the upload folder, I suggest not allowing the upload - force the person uploading it to rename it. That or rename it on the server side (add a number to it until it's unique) and tell them the new name. They could possibly also have to enter a description of the file, or you could just use its date if that's sufficient to distinguish it from others.
2) The output folder should be empty. You can run OKDO on the file, then rename the output folder to the filename and then replace the output folder with a new empty one.
3) Use glob to get the png files from the renamed folder using code similar to that which I've already given you. Run the slide show from that page.
4) Later, if someone wants to look at a list of the available pptx files and choose an existing one to view its png slideshow from, you can display the available pptx files using glob on the upload folder, or on whatever folder the file ended up in. The file dates could also be shown, or if there was a description and it was saved - say in a database or flat file, those could be displayed. When they choose the filename, glob the folder of that same name for the png files that are still there, essentially repeating step 3 above.
mignoncharly
06-17-2016, 06:05 AM
Hi,
well recapped. Thanks
jscheuer1
06-18-2016, 05:25 AM
OK, so we are basically now in agreement. Let me know if you need any help with the implementation. Try to be as specific as possible.
mignoncharly
06-20-2016, 11:54 AM
Hi John,
thank you for your help. As i have tried the software on my computer i didn't notice that it has been working because Microsoft Office was installed. But when i tried it at the office server it didn't work since i checked the requirements of the software. So this was my last attempt ... i'm done with it. thank for all.
i started the implementation but not finished because it would not be necessary at least for now
Charles
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.