Jump to content
xisto Community
Nikolas.a

Php And Flash Image Gallery Need some help in creating or editing an xml file while viewing some o

Recommended Posts

Hello there and thanks for the helping hand you are offering.
PHP newbie here! :)
So here is my problem:

On my website I have a flash image gallery.The way the gallery works is by uploading pictures in a folder and editing? an xml file.(pics.xml) where it adds the following code when you upload a picture:

<pictures>	<image location="nameofpicture1.jpg" desc="" />	<image location="nameofpicture2.jpg" desc="" /></pictures>
etc...

Now I have users that upload products they sell on the website or they advertise their business(hotels, jewellers, car resellers,...)
So for every "product" they post they upload their pictures to a specific path and I keep their pictures path in a mysql database.

I m trying to work a solution so that everytime a visitors clicks to see a product he gets the flash gallery for that product.
This means I have to create/edit the pics.xml file so that it only contains the pictures for that specific post.

So the user open a view_product.php which includes a php file that contains the flash. The flash gets the pictures for the gallery from the pics.xml file.

Any ideas on how to work out this problem?

Edit: I just uploaded the php file that edits the xml file if that is any help. I guess I could edit that file each time a user views a post but i dont think that's a good idea!

Notice from rvalkass:

You need CODE tags around any code you place in a post.

upload_pics.php

Edited by rvalkass (see edit history)

Share this post


Link to post
Share on other sites

That PHP file works by completely wiping and replacing the XML file each time you upload a new picture. If you only want certain pictures displayed then you need to limit which pictures the function that generates the XML can see. I would recommend creating a folder for each product, and put the images related to that product in its folder.Then, take out the XML generating part of the upload script and put it in a new page. Make it accept a variable (the product name) each time it is run. Then adjust the path for the folder it is reading from so that it has that variable stuck on the end. This would limit it to only using images for one product. It would also put the XML file in the same folder as the images - so you'd end up with a separate XML file for each product. Then you need to find some way for the Flash gallery to accept a variable from PHP, so it can be told where the XML file is.Sorry if thats not very clear, feel free to ask if you want it explained better and I'll give it a go :)

Share this post


Link to post
Share on other sites

That PHP file works by completely wiping and replacing the XML file each time you upload a new picture. If you only want certain pictures displayed then you need to limit which pictures the function that generates the XML can see. I would recommend creating a folder for each product, and put the images related to that product in its folder.
Then, take out the XML generating part of the upload script and put it in a new page. Make it accept a variable (the product name) each time it is run. Then adjust the path for the folder it is reading from so that it has that variable stuck on the end. This would limit it to only using images for one product. It would also put the XML file in the same folder as the images - so you'd end up with a separate XML file for each product. Then you need to find some way for the Flash gallery to accept a variable from PHP, so it can be told where the XML file is.

Sorry if thats not very clear, feel free to ask if you want it explained better and I'll give it a go :P


So the XML file is the key here! :)
I had another flash that would accept a php variable but if you clicked the flash it would take you to a different website.

the php file that contains the flash must be in the same folder as the xml file.
So if i create a folder for each product, and upload the pictures there, create the xml and add the php(flash) file then it should work and it wouldnt mess things up?
I guess working too many hours doesn't help thinking of the obvious.
I m gonna try this solution and post my results.
In the meantime if anyone has any other solution I d be glad to read and give it a try also!

Share this post


Link to post
Share on other sites

Well i finally made the files to be created automatically.

So now when i am at english/products/77(prod_id)/gallery.php i get to see the flash movies as it is supposed to be
When I try to load the movie in a file in english/offer.php?id=77 the movie loads but it doesnt show the menu, the settings or the images.

Does anyone know why?

This is the code in english/products/77(prod_id)/gallery.php

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="611" height="418" id="gallery" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="gallery.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="gallery.swf" quality="high" bgcolor="#ffffff" width="611" height="418" name="gallery" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://http://www.adobe.com/special/errorpages/404.html; /></object>

<? $prod_id=$_GET["id"]; ?><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="611" height="418" id="gallery" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="products/<?="$prod_id"?>/gallery.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="products/<?="$prod_id"?>/gallery.swf" quality="high" bgcolor="#ffffff" width="611" height="418" name="gallery" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://http://www.adobe.com/special/errorpages/404.html; /></object>

The movie loads ok, but it is supposed to use the following files and folders:
products/77/gallery.swf (which loads)
.../77/menu.xml
.../77/settings.xml
.../77/splash.img
../77/images_folder/
../77/images_folder/pics.xml
../77/images_folder/images.jpg
../77/images_folder/thumbs/
../77/images_folder/thumbs/images.jpg

if you want to see the pages then:
http://forums.xisto.com/no_longer_exists/ (works ok)
http://forums.xisto.com/no_longer_exists/ (doesn't work)
I was getting the loading menu on the top left of the flash when it couldn't find the menu.xml so my guess is the flash is being embedded in the /english/ folder but cant find the files it needs to work?
Edited by Nikolas.a (see edit history)

Share this post


Link to post
Share on other sites

i did a flash gallery recently just to test to see if my codes work and apparently it does

here is the link https://smallbusiness.yahoo.com/

The thing is i want to have a thumbnail for it as well so i can click on the photos i want to see.

The post above has a good flash gallery but its not what i want. It also takes too long to load so i just want something simple clean but gives alot of options at the same time. so far all my gallery does is load external images.. and you press back or forward ..

Is anyone here good at actionscript in flash at all?

I really really really need help on this.

Edited by keego (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.