• hi. first if all, thanks for your great support and help ?? .

    how can I GET the image name, of a current image used in the active Scene ? also getting the scene id og the current scene ?.

    and… last one ?? what are the string, so that I can call a specific scene ?.

    Explanation:

    my thought was that in each scene, I want to look at which image name is displayed and whose image exists in the folder with old images. Then I want to take the current Scene id, and make a button that calls the same scene id in the other Item/tour IF the current imagename that are used, also are in the old image map ?? . that way I can “easily” switch between new and old pictures, since I use the same names for the pictures.

    This is just a very quick explanation of the thinking ??
    original shortcode: [ipano id=”1″ sceneid=”abc123″]
    get imagename.

    If image (pic1.jpg) exists in old/images/ [
    get scene id ]

    ButtomToSceneId= “Sceneid”

    and then i will call scene id i just got.
    the old images: [ipano id=”2″ sceneid=”ButtomToSceneId”]

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Avirtum

    (@avirtum)

    To be honest, I don’t really understand what you want to achieve. If you want to see the source image for the scene, we can do this by displaying this information in some additional field using js. I can do an example of this.

    Thread Starter Michael M?ller

    (@unomobil)

    Thank for your Quick reply :).

    note: writing from my Phone, so autocorrect messing spejling up ??

    i have a tour of an festival arena where i am voluntere, i have a tour where nothing are placed in the are.
    And i have a tour where everything are placed.

    by having the option to Go on the “clean” tour, i Can see the whole are, and by clicking the “button” i could see the same scene, where everything are placed. (Like a befor and after image)

    so if i Can get the name of the image in currrent scene, i have a Way to generator the buttom for the scene in the “scene where everything is placed. By checking my “befor”folder and see if there is an image with the same name (if so, i also have a scene for it). And i would get the current sceneid of the current scene. Generate a link for my buttom where i just shangingchanging the item/tour id, that Will then show the other tour with the sceneid.

    does it make more sense ? ??

    Do you have to do this “automatically” with code? It seems you could just make the first scene in the tour “Before” and then the second scene “After”. It will create a button in the navigation menu to go back and forth?

    Or I believe you can even do it with a “Hotspot” linking to the other scene.

    Why must you create a new button?

    Thread Starter Michael M?ller

    (@unomobil)

    Yes. It need to be code, instead of a hotspot.
    a hotspot need to be made manual in all scene.
    And if I use the solution to shift between scene, Old, new, Old new, i Will be confusing.

    By coding it. The button wil be showed, if there is an image match in the “old” folder, and get the current sceneid, and make a link to the other tour and sceneid.. If not, the button will be hidden. All this will be automatic , so I don’t have to make a hotspot for each scene.

    if I had the option for getting the needed information, I would have been done already. I already did it with som external custom_fields just to se if work :).
    but I don’t know how to call the data from the scene.

    Thread Starter Michael M?ller

    (@unomobil)

    This is an example of the code I have now. There are probably better ways ?? but this I teste, and working when I am using existing data for test:

    // CHECK IF IMAGE EXISTS
    
    function checkIfImageExists(url, callback) {
    
    ??const img = new Image();
    
    ??img.src = url;
    
    ??if (img.complete) {
    
    ? ??callback(true);
    
    ??} else {
    
    ? ??img.onload = () => {
    
    ? ? ??callback(true);
    
    ? ??};
    
    ? ??img.onerror = () => {
    
    ? ? ??callback(false);
    
    ? ??};
    
    ??}
    
    }
    
    // Get current image name from this view/scene.
    
    $my_current_image_name = get_field('get_current_image_name');
    
    // Check If folder with old image exist, and have an image with the same name.
    
    checkIfImageExists('old_image_folder/<?php echo esc_url( $my_current_image_name ); ?>', (exists) => {
    
    ? ??// If existing??// Success code
    ? ? ??if (exists) {
    
    ? ? ? ??// Make field by using current sceneid, that show “old” tour.?
    
    ? ? ? ??$link_to_old_sceneid =??"[id=2” sceneid=“$sceneid_from_current_scene]”; ?>";
    
    const plugin = this;
    
    const $ = jQuery;
    
    // Get the CCS for Susses button, and insert link by echo the field $link_to_old_image into the href?
    
    const $btn = $('<a>').addClass('MyImgLinkOtherSceneYES').attr({'href':'<?php echo esc_url( $link_to_old_sceneid ); ?>','target':'_self'});
    
    plugin.$container.append($btn);
    
    ? ? ??}?
    
    ? ? ??// if NOT existing
    ? ? ??else?
    
    ? ? ??{
    
    ? ? ? ??// Fail code
    
    const plugin = this;
    
    const $ = jQuery;
    
    // Get the CCS for MyImgLinkOtherSceneNO button, and make link?
    
    const $btn = $('<a>').addClass('MyImgLinkOtherSceneNO').attr({'href':'#','target':'_self'});
    
    plugin.$container.append($btn);
    
    ? ? ??}
    
    ? ??});
    Plugin Author Avirtum

    (@avirtum)

    Let’s go step by step. If we want to get the scene image src, we can use this code

    
    const plugin = this;
    const $ = jQuery;
    
    plugin.$container.on('ipanorama:scene-show-complete', (e, data) => {
        console.log(data.scene.cfg.image);
    });

    Below is the list with plugin events we can handle

    
    Event Name                          Handler
     
    ipanorama:scene-camera-start     f(e, {scene})
    ipanorama:scene-camera-change    f(e, {scene})
    ipanorama:scene-camera-end       f(e, {scene})
      
    ipanorama:scene-before-load      f(e, {scene})
    ipanorama:scene-after-load       f(e, {scene})
    ipanorama:scene-progress         f(e, {scene, progress})
    ipanorama:scene-error            f(e, {scene})
    ipanorama:scene-show-start       f(e, {scene})
    ipanorama:scene-show-complete    f(e, {scene})
    ipanorama:scene-hide-start       f(e, {scene})
    ipanorama:scene-hide-complete    f(e, {scene})
      
    ipanorama:set-scene              f(e, {sceneId})
    ipanorama:next-scene             f(e)
    ipanorama:mode                   f(e, {mode})
      
    ipanorama:ready                  f(e)
    ipanorama:fullscreen             f(e)
      
    ipanorama:popover-show           f(e, {marker})
    ipanorama:popover-hide           f(e, {marker})
      
    ipanorama:tooltip-show           f(e, {marker})
    ipanorama:tooltip-hide           f(e, {marker})
    • This reply was modified 1 year, 10 months ago by Avirtum.
    Thread Starter Michael M?ller

    (@unomobil)

    Great ?? allots of option. But I have newer worked with this type of coding ??.

    how do I:

    1. get the image name (the name will be what I comparing with, to se if I need to get the sceneid and have the button feature.
    2. getting the sceneid
    3. “passing” the image name to a $imagename_that_i_can_use_as_Field
    4. “passing” the sceneid to a $Seceneid_that_i_can_use_as_Field

    Again, thank for your great support and willingness to help with all these special wishes and request ??

    Plugin Author Avirtum

    (@avirtum)

    This code below is for 1,2, but I do not understan about 3,4

    
    const plugin = this;
    const $ = jQuery;
    
    plugin.$container.on('ipanorama:scene-show-complete', (e, data) => {
        const image = data.scene.cfg.image.split('/').pop();
        const sceneId = data.scene.cfg.id;
        const sceneTitle = data.scene.cfg.title;
        
        console.log(image);
        console.log(sceneId);
        console.log(sceneTitle);
    });
    Thread Starter Michael M?ller

    (@unomobil)


    3 and 4 :

    I don’t know how to “convert” it to a custom field, that I can use.

    can I do it like this ?:

    $now_i_got_a_imagename_field_i_can_use = console.log(image);

    $now_i_got_a_sceneid_field_i_can_use = console.log(sceneId);

    Plugin Author Avirtum

    (@avirtum)

    The problem is that I don’t see your code in its fully, so it’s hard for me to evaluate and understand it.

    Thread Starter Michael M?ller

    (@unomobil)

    Im not shure how to do it otherwise ??.

    But I will try again ??.

    how to get name of the image, used in a scene, an make a $display_image_name output with that name.
    also
    how to get name of the sceneid, used, an make a $display_sceneid_name output with that sceneid.

    by doing this, I could do this:

    echo ‘<h3>this is the name of the image:’ . $display_image_field'<h3>’;

    echo ‘<h3>This is the name of the sceneid:’ . $display_sceneid_field'<h3>’;

    Plugin Author Avirtum

    (@avirtum)

    Maybe better to write me to email ) I kind of showed you how to get the name of the scene image file and the scene ID.

    Thread Starter Michael M?ller

    (@unomobil)

    Okay thanks :).

    Thread Starter Michael M?ller

    (@unomobil)

    I figured it out ??. I never use “simple” descriptions as image, as it can (collide) with other fields :). So I thought the should “convertes” to a field first.

    everything is work as it should . And I am almost done ??. Just need to make it more simple to understand for other (inc. my self) ??.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Get imagename of current scene’ is closed to new replies.