problems with updated version #2

Open
frequent opened this Issue Jun 9, 2012 · 6 comments

Comments

Projects
None yet
2 participants

frequent commented Jun 9, 2012

Happy to see there's a Coldfusion port for AI. I set it it on localhost and it's not really working (I'm using CF8).

I have fixed the CF errors I found (missing a few semicolons, declaring var on top etc), but these seem to be the easy fixes..
If I ever get to work I will do a pull request (If not, I'm back to trying to fiddle in the php version).

Owner

cfjedimaster commented Jun 9, 2012

To be clear though - I don't think CF8 compat issues are bugs. I wrote it for CF9 and I think that backporting to 8 would be a mistake (imo ;).

frequent commented Jun 9, 2012

I understand. I'm still stuck on CF8, so I'll be backporting away.

frequent commented Jun 9, 2012

@cfjedimaster - ok, got it to work. You are correct about backporting. It's lame... :-)

I found the following things to be tricky (not sure if CF8/CF9 related, or supposed to be like this, my first month of CF...)

  1. request_uri sets the requested image path to "adaptive-images.cfm"

    I'm defaulting to fallback on Apache and use CGI.redirect_url

  2. if no width/height parameters were passed structKeyExists(url,"width") seems to fail (not sure)

    I'm doing all the ?parameters in a if( !StructIsEmpty(url) ) { scale/crop } else{ regular }

  3. on my localhost I'm ending up with a\lot\of\forward/backward/slashed/path/names.jpg

    I'm setting document root like so:

root = Replace( expandPath("/"), "\", "/", "all" );
    if ( Right(root, 1) EQ "/" )
        document_root = Left(root, Len(root)-1 );
    else
        document_root = root;

I would have a few questions, if you could spare some thoughts:

  • Initial load times take time. Is this CF re-processing the images or my lame localhost? Can this be sped up?
  • I'm trying this in a 10 image slider. If I delete the cache and refresh the page, the first couple of image fail, the rest works. Seems like a "traffic jam" inside the function (too many images requested). Any idea how to avoid this?
  • Would this be better off in a cfc?
  • If I wanted to do this with large image volumes, do you see any downside? I like that images are cached the first time a user requests them, but I'm trying to think this through for possible caveats.

A BIG THANKS for writing this up (and sparing me my first php session). I'll be playing around with your Resize options to see how to get the best quality & fastest load time)

Owner

cfjedimaster commented Jun 10, 2012

"if no width/height parameters were passed structKeyExists(url,"width") seems to fail (not sure)"
That makes no sense - if you can find out exactly what it was - let me know.

"on my localhost I'm ending up with a\lot\of\forward/backward/slashed/path/names.jpg"

But did they break? I always use / since it works with Windows or Unix. So on Windows, you may see a path with both \ and / in it, but if it works, it shouldn't matter.

"Initial load times take time. Is this CF re-processing the images or my lame localhost? Can this be sped up?"
If you tweak the quality setting, yes. :) I see you saw that (last part of your comment)

"I'm trying this in a 10 image slider. If I delete the cache and refresh the page, the first couple of image fail, the rest works. Seems like a "traffic jam" inside the function (too many images requested). Any idea how to avoid this?"

Got a zip I can try?

"Would this be better off in a cfc?"
I used a CFM just to make the URL a bit simpler, if I remember right anyway.

"If I wanted to do this with large image volumes, do you see any downside? I like that images are cached the first time a user requests them, but I'm trying to think this through for possible caveats."

You would possibly want to consider creating a script that would request the images in all possible sizes. Ie, a way to 'force' the creation so that images are - basically - precached.

Thanks for the infos. I'm trying to pull the slider page out in a zip file. I'll post the link here.

Sorry for getting back late.

While I managed to get it to work on my dev/localhost, production was a different story. I wanted to test AI in the slider and mainly use it for a product search. Slider worked ok, but the product search was a pain, because I needed to pull in and render images from user specified sources and with users potentially not sticking to image size recommendations.

I tested a little - both adaptive images and my own script pulling in and resizing just took too long, so the search was terribly slow to return results (waiting for image processing).

I eventually ditched the whole approach and am now offering users to auto-upload images to S3 when they import product data. Since this is not time critical, I can generate S,M,L,XL versions of each image. I added a log entry for generated images in the database, so in my product search I can just include this info in my search routine and request the S3 image if log enty has been made for the respective item.

Anyway:
I only wanted to post these two links (picturefill, Git ). Maybe a nice alternative to AI. I'm playing around with this now vs. using the AI leftover cookie.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment