By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,222 Members | 1,730 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,222 IT Pros & Developers. It's quick & easy.

open a new page with images as param

P: n/a
Hi all,

I'm stuck with some php code that runs out of time limit. This is due to a
long XML file process that has to save pictures on the disk.

What I've now:
- read XML file
- parse XML file
- for every article
- save datas in Database
- save pictures on harddisk
- save path on hardisk
delete XML file

What I'd like to do:
- read XML file
- parse XML file
- for every article
- save datas in Database
- call the savepictures script with images as param
delete XML file

the savepictures scipt:
- save pictures on harddisk
- save path on hardisk
- close itself

My question are:
1- it is possible to call such "savepictures" script using javascript (I
can't use Exec on my ISP).
2- if yes, how can I give the images as parameters ? They are actually
base64 encoded in an array and I save them using
fwrite($imgfile,base64_decode($picarray[$I]));
3- will this be a "blocking" process (the script must wait the new window to
open in order to continue running)

Thanks for help.

Bob

Dec 5 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Bob Bedford wrote:
Hi all,

I'm stuck with some php code that runs out of time limit. This is due to a
long XML file process that has to save pictures on the disk.

What I've now:
- read XML file
- parse XML file
- for every article
- save datas in Database
- save pictures on harddisk
- save path on hardisk
delete XML file

What I'd like to do:
- read XML file
- parse XML file
- for every article
- save datas in Database
- call the savepictures script with images as param
delete XML file

the savepictures scipt:
- save pictures on harddisk
- save path on hardisk
- close itself

My question are:
1- it is possible to call such "savepictures" script using javascript (I
can't use Exec on my ISP).
2- if yes, how can I give the images as parameters ? They are actually
base64 encoded in an array and I save them using
fwrite($imgfile,base64_decode($picarray[$I]));
3- will this be a "blocking" process (the script must wait the new window
to open in order to continue running)

Thanks for help.

Bob
Hi,

Kind of strange question in a JS newsgroup.
Javascript cannot really help here, because the saving of pictures is a
serverside (PHP) action.
You can of course let JS pass the locations of the images to some php-script
in the form of http://www.example.com/images/myimage.png
and let PHP open that picture, stream it into memory, and save it in the
database.
PHP can open a file on the net simply with fopen(), and it will figure out
itself it needs a http-wrapper.

Regards,
Erwin Moller
Dec 5 '06 #2

P: n/a
Hi,
>
Kind of strange question in a JS newsgroup.
Javascript cannot really help here, because the saving of pictures is a
serverside (PHP) action.
You can of course let JS pass the locations of the images to some
php-script
in the form of http://www.example.com/images/myimage.png
and let PHP open that picture, stream it into memory, and save it in the
database.
PHP can open a file on the net simply with fopen(), and it will figure out
itself it needs a http-wrapper.
Hi Erwin,

thanks for replying.

Actually my question is how to open a new window passing as param the images
array using javascript, as I can't use Exec or fpassthru or likes
(disallowed by ISP).

I'd like to know how to do something
window.open('newscript.php?imagearray'). passing the array of base64 encoded
files is also something I don't know how to do. It's a pure javascript
question, as the PHP part is known.

Bob

Dec 5 '06 #3

P: n/a
Bob Bedford wrote:
>Hi,

Kind of strange question in a JS newsgroup.
Javascript cannot really help here, because the saving of pictures is a
serverside (PHP) action.
You can of course let JS pass the locations of the images to some
php-script
in the form of http://www.example.com/images/myimage.png
and let PHP open that picture, stream it into memory, and save it in the
database.
PHP can open a file on the net simply with fopen(), and it will figure out
itself it needs a http-wrapper.
Hi Erwin,

thanks for replying.

Actually my question is how to open a new window passing as param the images
array using javascript, as I can't use Exec or fpassthru or likes
(disallowed by ISP).

I'd like to know how to do something
window.open('newscript.php?imagearray'). passing the array of base64 encoded
files is also something I don't know how to do. It's a pure javascript
question, as the PHP part is known.

Bob

When you open a child window, the data of the parent is still accessible
.. Lets say you have...

var myimg = new Image()
myimg.src='some.gif';

Now pop a new window and you should be able to access that original
image as parent.myimg . So you don't really need to pass the actual
image, you just need to pass the array location where the image you want
to process happens to reside.

Note that I haven't tested this and it's been a long time since I've
done cross-window/frame communications since ajax and DHTML makes
popups/frames outdated. The syntax may be off but I do know that it's
possible.

--
---------------------------------------------------------------------------
http://www.hunlock.com -- Permanently under construction (And proud of it!)
$FA
Dec 5 '06 #4

P: n/a
ASM
Bob Bedford a écrit :
Actually my question is how to open a new window passing as param the images
array using javascript, as I can't use Exec or fpassthru or likes
(disallowed by ISP).
I understand the image to save is previously displayed on main page.
true ?

I understand you know how to get it by browser's tree of images (images
array)
true ?
I'd like to know how to do something
window.open('newscript.php?imagearray'). passing the array
You want to pass the document images array in its totality ?

function popImgs()
var I = new Array();
for(var i=0;i<document.images.length;i++)
I[i] = document.images[i].src;
window.open('newscript.php?imagearray='+I);
}

Every address of image separated from its neighbours by , (coma ?)

of base64 encoded
files is also something I don't know how to do.
doesn't browser encode directly by default in base 64 ?

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Dec 5 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.