Connecting Tech Pros Worldwide Forums | Help | Site Map

open a new page with images as param

Bob Bedford
Guest
 
Posts: n/a
#1: Dec 5 '06
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




Erwin Moller
Guest
 
Posts: n/a
#2: Dec 5 '06

re: open a new page with images as param


Bob Bedford wrote:
Quote:
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
Bob Bedford
Guest
 
Posts: n/a
#3: Dec 5 '06

re: open a new page with images as param


Hi,
Quote:
>
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



pcx99
Guest
 
Posts: n/a
#4: Dec 5 '06

re: open a new page with images as param


Bob Bedford wrote:
Quote:
Quote:
>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
ASM
Guest
 
Posts: n/a
#5: Dec 5 '06

re: open a new page with images as param


Bob Bedford a écrit :
Quote:
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 ?
Quote:
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 ?)

Quote:
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
Closed Thread