I am currently trying to get the downloadURL from a response sent via my server of which, whenever $file->getdownloadUrl() is used it returns ['downloadURL'] =>
My question is, is it possible to download Google Documents in the application/vnd.google-apps.document MIME Type?
My assumption is, these would contain a link to the online version of the document, but it would be good to be able to edit the document in the correct format so that any formatting done would be retained when re-uploaded to drive,
Regards,
Nope, you cannot download Google Documents in application/vnd.google-apps.document MIME type. You only can export it to other formats.
Some workarounds:
Apps script Document Services provide a little bit better control over the document, but you won't be able to get full control over all formatting for now.
Export file as known formats such as Microsoft words and edit it. When you upload it back to Drive, you can request to convert it back to Google Docs format. Although you might possibly lose or corrupt with some formatting.
Related
I have a php script which uses the Flickr API to download my images from Flickr, parse the associated text and metadata, and save versions on my server with the metadata embedded in the image files. I work with historic images and want to display them in date order on my smartphone (I'm trying out F-Stop app on Android).
I've got the metadata update working using the PHP JPEG Metadata Toolkit - http://www.ozhiker.com/electronics/pjmt/ - by writing XMP data to the files. But for the life of me I can't seem to get the 'date taken' working!
Here are some sample images:
This is the original file from Flickr, with the date set as the date I created the file http://metapicz.com/#landing?imgsrc=http%3A%2F%2Fwww.whatsthatpicture.com%2Ftools%2FPHP_JPEG_Metadata_Toolkit%2Fflickr.jpg (right-click on the image and save it if you want to inspect it locally)
Here's my first attempt with the toolkit. It has updated the XMP 'DateCreated' but not the EXIF CreateDate or XMP CreateDate http://metapicz.com/#landing?imgsrc=http%3A%2F%2Fwww.whatsthatpicture.com%2Ftools%2FPHP_JPEG_Metadata_Toolkit%2Fprocessed_orig.jpg
So I then forced it to change the XMP CreateDate http://metapicz.com/#landing?imgsrc=http%3A%2F%2Fwww.whatsthatpicture.com%2Ftools%2FPHP_JPEG_Metadata_Toolkit%2Fprocessed_new.jpg. This then showed up in Windows Explorer as the date created, but not in the F-Stop app.
So I was wondering if the EXIF CreateDate, which is still at the value from Flickr, was taking precedence so I stripped that metadata out (the toolset doesn't allow you to modify EXIF, as far as I can see) http://metapicz.com/#landing?imgsrc=http%3A%2F%2Fwww.whatsthatpicture.com%2Ftools%2FPHP_JPEG_Metadata_Toolkit%2Fprocessed_new2.jpg
In none of these cases does F-Stop interpret the date correctly. I have contacted the devs but I don't actually think it's the app at fault, I think it's the metadata format in the files. That's because when I displayed that original file in Windows Explorer and changed the Date Taken there, this file works perfectly http://metapicz.com/#landing?imgsrc=http%3A%2F%2Fwww.whatsthatpicture.com%2Ftools%2FPHP_JPEG_Metadata_Toolkit%2Fflickr_win.jpg
Can anyone tell what is going on, or suggest another way I might go about this?
OK, I've now solved this.
It seems that the FStop app can't read dates from the xmp files so it was either reading them from the JFIF/App12/"Ducky" segment at the beginning of the file, or if that didn't exist it was reading the file timestamp. Of course that meant my plan to create a single xmp profile with all my metadata wasn't going to work.
I switched to ImageMagick but that faced the same problem - I could strip profiles and load/change an xmp profile but couldn't immediately see a way to get it to create/update the date values in the JFIF segment.
So in the end I resorted to calling exiftool via an exec command
exec("exiftool -AllDates='1863-07-23 12:00:00' -overwrite_original testfile.jpg");
(I'll change it away from AllDates and just set CreateDate, but I need to test that)
A bit clunky, but it works! I'm using Imagick anyway for modifying the actual images, so if anyone does know a way I might modify those headers there then I'd be delighted to hear it.
I need to create a php webservice to send pdf files to an iPad application. I don't know the number of files, I will be sent a last sync date and web service must send all documents after that date.
If it was only one file, I guess I could do it using headers to set content type but how can I send multiple documents?
Thanks in advance
Zip all the PDF documents after the specified date and bundle using PHP Zip library and send them in the content type as application/zip
From the receiving side, they will unzip and use the documents.
An easier approach might be to merge all the pdfs into one using fpdf.
This would allow the browser to handle display and saving though it does leave the user in the position of having to manage larger files. It really depends on what the data is for as to whether this approach will work.
I want to make a web app that can get the values from a commonly used file type (such as xsl or ppt) to allow me to convert it into a custom format (like Google Drive). With an xsl (excel document) file, for example, I want to be able to get the value for each cell. I would be fine getting html for a file (like getting the html code that would display a word document) because values can be extracted out of that. I would like to be able to do it on the client side, but I am okay with using it on the server side with PHP.
Another approach would be to import the file as XML. PHP has great support for XML and could make short work of this. If you can get the files uploaded as Open Doc Format you can parse just about any of the types you listed (XLS, PPT, DOC, etc).
A pretty easy way to get data out of an excel sheet online is to use a Google Apps Script. The process would be a lot to explain here, but with a bit of google searching, you can find all your answers.
As for a PPT, I can't think of an easy way.
As for documents (i.e. pdf, doc, docx), you can use Google Apps Script as well.
Although, if you're making your own tool for this, you may want to just research how the data is stored in the file and work from there.
i've been searching for quite a long now to convert a word document (.doc & .docx ) to pdf.....my application is about taking a word document from clients than converting them to a pdf with added changes ( like header, footer ) to the original document.
Any suggestions are welcomed.
Thank you
Look at http://www.phplivedocx.org/ for converting DOC to PDF.
Example code with nusoap, http://www.phplivedocx.org/articles/using-livedocx-with-nusoap/
You can call the Docmosis Cloud Services from PHP using a http post or curl command. It supports doc and docx imports and pdf outputs. It's more intended to perform document manipulations than conversions but perhaps that suits you even better. Please note I work for the company that created Docmosis.
Hope that helps.
This is a year old, but for people still looking I found a link to a pretty decent api you can look at and see if it works for your needs.
https://cloudconvert.org/page/api#overview
Essentially you use their api and a key they provide when you sign up for an account. Send all the data for conversions to their servers then get the return. You can then store it on your own computer, the users computer, or a server of your choosing. There is some minimal set up and sign up processes and their Github account walks you through pretty easily.
Check it out and hopefully it is a good choice.
We need to install below libraries on server for convert DOC file format to PDF file format:
(Libre Office OR Open Office) and Unoconv librarie
I'm sorry if the question is ambiguous, I'll try to explain.
I'm working on an existing PHP download script for videos and some parts of it are broken. There's code in there that's supposed to place a specific member code inside the video file before download, but it doesn't work. Here's the code:
//embed user's code in video file
$fpTarget = fopen($filename, "a");
fwrite($fpTarget, $member_code);
fclose($fpTarget);
$member_code is a random 6-character code.
Now, this would make sense to me if it were a text file, but since it's a video file, how could this possibly work and what is it supposed to do? If the member code is somehow added to the video, how can I see it after download it? I have no experience with video files, so any help is appreciated (a modification of the available code or new code would be equally welcome).
I'm sorry I can't give a more precise description of what the code is supposed to do, I'm trying to figure that out myself.
It may work, depending on the format/type of the video. MPG files are fairly tolerant of "noise" in a file and players would skip over your code because it doesn't look like valid video frame data.
Other formats/players may puke, because the format requires certain data be at specific offsets relative to the end of the file, which you've now shifted by 6 characters.
Your best bet is to figure see if whatever format you're serving up has provisions for metadata in its specifications. e.g. there might be support for a comment field somewhere that you can simply slap the code into.
However, if you're doing all this for 'security' or tracking unauthorized sharing of the video, then simply writing the number into a header is fairly easy to bypass. A better bet would be to watermark the video somehow so that the code is embedded in the actual video data, so that "This video belongs to member XYZ only" is displayed while playing.
You don't write to the content of the file directly, not like you would with a text file. As you've noticed, this effectively corrupts the video and you have no way of reasonably reading the information.
For audio/video files, you write to meta-data that's packaged with the file. How this is packaged and what you can do with it generally depends heavily on the container format used for the file. (Remember that container and codec are two different things. The codec is the format used to encode the audio/video, the container is the file format in which that data stream is stored.)
A library like getID3 might be a good place to start. I've never used it, but it seems to be what you're looking for. What you would essentially do is write a value to the meta-data in the container (either a pre-defined value for that container or maybe a custom key/value pair, etc.) which would be part of the file. Then, when reading the file, you can get that data. (Now, that last part depends heavily on what's reading the file. The data is there, but not every player cares about it. You'll want to match up what you're writing to with what you usually see/read from the file's internal meta-data.)