Posted by duckzland on June 8, 2010 at 3:08pm
Hi,
I have a question for drupal json, for example on the server side I have a code that will get like 10 images fetched then feed the data back via ajax using drupal_json.
currently the workflow:
1 post -> 10 images fetched -> 10 images passed via json -> 10 images displayed at once.
is it possible to have this?
1 post-> 1 image fetched -> 1 image passed via json -> 1 image displayed at once -> refetched another image without doing another post loop until all 10 image is shown one by one
Comments
Are you sending the actual
Are you sending the actual image data back in your json call or something? You should only need to send the filepath back.
I guess what I'm trying to say is, what are you trying to do? It's always better to explain your problem rather than asking vague questions.
Full-time freelancer, always looking for work.
jaypan.com (my portfolio)
the server will process the
the server will process the image with imagecache and send the filepath of the processed image back to json.
I'm building a image gallery that utilizes ajax for retrieving thumbnail, original image and deleting the image.
--------------------------------------------------------------------------------------------------------
if you can use drupal why use others?
VicTheme.com
skype id : duckzland
That's not how Imagecache
That's not how Imagecache works. Imagepath will generate the filepath right away and send it back. It's only when the path is accessed that Imagecache generates the image.
Full-time freelancer, always looking for work.
jaypan.com (my portfolio)
yes, I'm calling the
yes, I'm calling the imagecache to process and build the thumbnail so when its displayed the thumbnail exist.
I'm invoking the theme('imagecache', preset_name, filepath) and then parse the html tag back to json. the question is is it better to build all the 10 images and send the large chunk of html tag back to json or else?
--------------------------------------------------------------------------------------------------------
if you can use drupal why use others?
VicTheme.com
skype id : duckzland
It won't process the images
It won't process the images until they are accessed. So image cache will build the HTML tags, send them by Json to the browser. The browser will then try to access those images and THEN they will be generated.
Full-time freelancer, always looking for work.
jaypan.com (my portfolio)
ok, thanks for the
ok, thanks for the enlightenment :) , so what do you think, is it still needed to call the theme() function before parsing it to json or do the html tag using jquery?
--------------------------------------------------------------------------------------------------------
if you can use drupal why use others?
VicTheme.com
skype id : duckzland
Well if you are using
Well if you are using Imagecache, you will need to call the theme function first, unless you already know what the path to the imagecache file will be.
Full-time freelancer, always looking for work.
jaypan.com (my portfolio)