Jump to content

Recommended Posts

I get "There was an error executing this query. Please try later." when trying to use the search :(

Anyway, what i want to do is extract an xml file from a tar file. Then read the xml file to get the names of the pictures (done that bit), then use that info in using imagecopyresized to concatenate some of the pictures in the tar into 1 (done this to). The problem i'm having is finding a way to extract the files within the tar so i can use them. Is there any inbuilt php functions to help me do this? I know there is zlib with its gz functions but isn't that just for gz tar files?

and if you don't understand i have a tar file with these files in it:

a.jpg
b.jpg
c.jpg
d.jpg
e.jpg
info.xml

Using the xml file i can get the names of the images i want to use, so my xml file tells me that the images i want to use are b.jpg, c.jpg and d.jpg. I have used imagecopyresized() to add these pictures into 1. I just need to find a way of getting the files out of the tar file. Maybe extract them to a temporary directory, then delete them after use.

I'm still quite a new person with php and no nothing really about tar files [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]

Thanks and hope you understand :)
Link to comment
https://forums.phpfreaks.com/topic/10844-extracting-tar-files-using-php/
Share on other sites

Well, unless you want to code your own tar functions, you can try to use ready classes:

[a href=\"http://www.phpconcept.net/pcltar/index.en.php\" target=\"_blank\"]http://www.phpconcept.net/pcltar/index.en.php[/a]

Or try to find a TAR class here:
[a href=\"http://www.phpclasses.org\" target=\"_blank\"]http://www.phpclasses.org[/a]
Thanks :)

Used [a href=\"http://pear.php.net/package/Archive_Tar\" target=\"_blank\"]http://pear.php.net/package/Archive_Tar[/a] in the end. Was annoying though; when creating tars on my apache server on windows i was using files with no extensions and their location as "filename/", which worked in windows (added file and hid it (made it into a folder i think)), but on linux if i try and do that it just says it can't find the file and without the "/" it doesn't hide them. Shame as i wanted to do this. But for normal use it's perfect :)
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.