Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorfjordside
    • CommentTimeSep 8th 2008
     
    Hi All,

    First of all thank you very much for this excellent system...

    Im trying to xmlout my albums for use with a flashfrontend, wich works very nice allready.
    However I'm having some problems with domainnames spelled with and without the www (www.mysite.com / mysite.com) - as it seems to crash the relative path im using in flash.

    I think the problem lies in that i use the plog-thumb.php to return the thumb, and if the returned path to the jpg is with the www - the flashsandboxing wont let flash load the image if the path to the swf is without the www.

    So the short question is (thankyou for your patience):
    Is there a way for me to retrieve the relative path to the intermediate thumb?.

    If anyone can shed some light on this I would very much appreciate it.

    Thanks

    Jan Fjordside
    •  
      CommentAuthormemic.a
    • CommentTimeSep 8th 2008 edited
     
    Hi fjordside

    Is there a way for me to retrieve the relative path to the intermediate thumb?.


    Try using the function

    plogger_get_picture_thumb(THUMB_LARGE);
    • CommentAuthorfjordside
    • CommentTimeSep 8th 2008
     
    Memic.a, thank you for your answer.

    I've allready tried that without luck. In my post I forgot to say that im working in a modified version of the plog-xml.php (wich works in another loop, on wich the plogger_get_picture_thumb relies)(I think).

    Btw. I've also tried the THUMB_SMALL option - also with no luck, in both cases the returned value == ""

    I've added my code around line 260 in the loop:


    foreach ($pictures as $picture){
    if ((isset($_GET["album_id"]) && ($_GET["album_id"] == $picture["parent_album"])) || !isset($_GET["album_id"])){
    if ((isset($_GET["pictures"]) && ($_GET["pictures"] == 1)) ||
    (isset($_GET["picture_id"]) && ($_GET["picture_id"] == $picture["id"]))){
    if ($limitType == 'pictures'){
    if ($total == $limit){
    break;
    }

    $total++;
    }

    $picture["sm_thumb_path"] = 'plog-thumb.php?id='.$picture["id"];
    $picture["lg_thumb_path"] = 'plog-thumb.php?id='.$picture["id"].'&type=2';
    //this is where i try to get the large thumbpath...
    $picture["relPathLargeThumb"] = plogger_get_picture_thumb(THUMB_LARGE);


    $xml .= '<picture';
    ...


    anyway any suggestions are very welcome.

    Thanks
    •  
      CommentAuthormemic.a
    • CommentTimeSep 8th 2008 edited
     
    Try with this, maybe it works


    $id = $picture["id"];
    $pic = get_picture_by_id($id);
    $path = $pic['url'];

    $picture["relPathLargeThumb"] = generate_thumb($path, $id, THUMB_LARGE);


    P.S I didn't try it, don't know if it works
    • CommentAuthorfjordside
    • CommentTimeSep 9th 2008
     
    Hmmm Sorry no luck I cant make it work.

    But I noticed something funny:

    if i call

    http://xxxx.xx/plogger/plog-thumb.php?id=5&type=2 (wich should give me the thumb i want)(notice its without the www)

    I get this returned:

    http://www.xxxx.xx/plogger/thumbs/lrg-5-stockvault_8593_20071011.jpg (notice the www is added)

    The addition of the www, triggers flash's sandboxsecuritysystem (or something) wich wont let the swf file at the domain without the www, load
    images from the (same) domain with the www.

    So if there is a way to have plog-thumb.php return the filestring prefixed with the config['baseurl'] instead of the config['galleryurl'] - I think that will solve my problem.

    Anyways, Im by no means a php/ploggerexpert so any input are very welcome.

    Thanks.
    •  
      CommentAuthorsidtheduck
    • CommentTimeSep 9th 2008
     
    fjordside,

    If you want it to be returned without the 'www', you should remove the 'www' from the Gallery URL as stored in the Admin -> Options tab. The $config['gallery_url'] is used instead of $config['baseul'] for image paths because baseurl is transitive (it changes based on where the script is being called from) and gallery_url is static and always returns the path back to the Plogger installation. Does that make sense?

    Try just removing the 'www' from the Gallery URL in the Admin -> Options section and see if that clears up your issue.
    • CommentAuthorfjordside
    • CommentTimeSep 10th 2008
     
    Sidtheduck,

    Thank you for your answer..

    Unfortunately, removing the www from the galleryurl under the options tab just reverses my problem.
    And flash still thinks it's on another domain than the domain holding the images.

    The problem originates from the fact that some users type www.xxxx.xx in the address where other users type xxxx.xx (without the www).
    Therefore I would actually prefer the returned url from plog-thumb.php (or other way of retrieving the path) to be transitive.

    Another solution to my problem could also be a the path to the thumb from the site root (I just cant find a way to produce this, again im seriously lacking phpskills).


    Thanks.
    •  
      CommentAuthorsidtheduck
    • CommentTimeSep 10th 2008
     
    Sorry fjordside, I misunderstood what you were looking for.

    Try this. Open 'plog-thumb.php' and find the following code:
    $path = generate_thumb($thumb["path"], $thumb["id"], $thumb["type"]);

    header("Location: ".$path);

    and edit it like this:
    $path = generate_thumb($thumb["path"], $thumb["id"], $thumb["type"]);

    // make sure the generated url and the browser url have the same domain syntax
    $browser_www = strpos($_SERVER['HTTP_HOST'], 'www');
    $thumb_www = strpos($path, 'www');
    if ($broswer_www !== $thumb_www) {
    if ($browser_www === false) {
    $path = str_replace('www', '', $path);
    } else {
    $path = str_replace('//', '//www.', $path);
    }
    }

    header("Location: ".$path);
    • CommentAuthorfjordside
    • CommentTimeSep 10th 2008 edited
     
    Sidtheduck,

    Thankyou very much for your code, to start out with it wouldnt work. But somehow Ive managed to tweak it so it worked.

    Here the tweaked version is, just in case someone else needs it:


    $path = generate_thumb($thumb["path"], $thumb["id"], $thumb["type"]);
    // make sure the generated url and the browser url have the same domain syntax
    $browser_www = strpos($_SERVER['HTTP_HOST'], 'www');
    $thumb_www = strpos($path, 'www');
    if ($browser_www !== $thumb_www) {
    if ($browser_www === false) {
    $path = str_replace('www.', '', $path);
    } else {
    $path = str_replace('//', '//', $path);
    }
    }
    //echo "<script>alert('$path');</script>";
    header("Location: ".$path);




    Thanks again....:-)
    •  
      CommentAuthorsidtheduck
    • CommentTimeSep 10th 2008 edited
     
    fjordside,

    You are correct with the first part (I forgot the dot after www), but the second part I think you have incorrect.

    I think it should be:

    $path = generate_thumb($thumb["path"], $thumb["id"], $thumb["type"]);
    // make sure the generated url and the browser url have the same domain syntax
    $browser_www = strpos($_SERVER['HTTP_HOST'], 'www');
    $thumb_www = strpos($path, 'www');
    if ($browser_www !== $thumb_www) {
    if ($browser_www === false) {
    $path = str_replace('www.', '', $path);
    } else {
    $path = str_replace('://', '://www.', $path);
    }
    }
    //echo "<script>alert('$path');</script>";
    header("Location: ".$path);


    Can you test?
    • CommentAuthorfjordside
    • CommentTimeSep 11th 2008
     
    Sidtheduck,

    I think you are right....

    I seems my hack prefixes with www even though the url is without.

    Your revised code, however works perfect....Thanks :-)
    • CommentAuthorfjordside
    • CommentTimeSep 11th 2008
     
    Hi again,

    Actually I found out the code reacts different on different hosts.

    Here are some testresults:

    UnoEuro.dk:

    my hack
    www.xxxx.xx gives xxxx.xx
    xxxx.xx gives xxxx.xx

    your code (works as intended on UnoEuro.dk)
    www.xxxx.xx gives www.xxxx.xx
    xxxx.xx gives xxxx.xx


    one.dk

    my hack (works as intended on one.dk)
    www.xxxxx.xx gives www.xxxx.xx
    xxxx.xx gives xxxx.xx

    your code
    www.xxxx.xx gives www.www.xxxx.xx
    xxxx.xx gives xxxx.xx


    I find this very weired, but maybe its connected to different serverconnections.
    (The mystery continues - anyways I see the problem as solved for my part, and am very happy with the solution - though it would
    be nice to be able to figure out what makes the difference on the two servers)

    Thanks :-)