Link to thumbnail - urlencode problem

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1202
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Link to thumbnail - urlencode problem

Post by onoehring » 2024-04-18 07:58

Hi,

I am hoping for some insight of you.
I almost finished my proposed "Multi Path Upload (MPU) / dynamic upload folder" (viewtopic.php?f=12&t=5349) but there seems something weird.

For "problem-only" please see below.

Currently I am still using AG 24.11 but the script will also work with the new 24.12 (and newer) versions.

Please take a look at the following images with this setup in mind:
My MPU script will move uploaded files to subdirectories of the original uploads folder. Example:
Original uploads folder is /images
The MPU might be configured to use a 3 digit subfolder thus uploaded files may reside in folders depending on their primary key (pk)

Code: Select all

pk =     1 -> new upload path will be /images/001
pk =     2 -> new upload path will be /images/002
pk =    15 -> new upload path will be /images/015
pk =   370 -> new upload path will be /images/370
pk =  4891 -> new upload path will be /images/891
pk = 94891 -> new upload path will be /images/891
pk = 96001 -> new upload path will be /images/001
pk = 96015 -> new upload path will be /images/015
The MPU script will also include a nice "initialize" to upgrade your current application, e.g. the uploaded files and move them to the correct subfolders. Only absolute minimal changes are needed in a) hooks/tablename.php and b) in one of the generated files ... sorry :(
The display of thumbnails works just fine, note the link in the status bar:
TV view. Clicking on the thumbnail displays the zoomed image when allowed in AG (from the subdirectory):
tv_img.png
tv_img.png (60.23 KiB) Viewed 1281 times

TV/DV view combined, here DV. Clicking on the thumbnail displays the zoomed image when allowed in AG (from the subdirectory):
tv_dv_imd.png
tv_dv_imd.png (63.6 KiB) Viewed 1281 times

For uploaded PDF it looks pretty much the same (TV/DV combined). Clicking on the thumbnail displays the zoomed image when allowed in AG (from the subdirectory):
tv_dv_doc.png
tv_dv_doc.png (12.81 KiB) Viewed 1281 times

When displaying the uploaded PDFs in their parent table's child-view, AG translates it to a "link.php...." URL. Clicking on the link displays/downloads the correct file (remember: which is placed in a subdirectory):
child_tab_doc.png
child_tab_doc.png (12.34 KiB) Viewed 1281 times

When I have the uploaded child-images displayed in their parent records as child-pages (see image below), and click on the "Anzeigen" (english: display) button on the left, the correct modal sub-page opens and the image is shown correct - and clicking works to zoom it:
child_opened_img.png
child_opened_img.png (57.46 KiB) Viewed 1281 times
I need to split my post here to upload another image ...

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1202
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Link to thumbnail - urlencode problem

Post by onoehring » 2024-04-18 07:59

my post continued ...

Now the PROBLEM
When I have the uploaded child-images displayed in their parent records as child-pages (see image below), and I try to click on the thumbnail ... the wrong link is generated by AG. The subdirectory which is saved in the filename field of the table and is correctly handled in all other (described .. did I forget something) situations, is urlencoded thus the zoom of the images does not work.
Value in imagefield: 481/3567b318bb07348e5.jpg
Link generated by AG: 481%2F3567b318bb07348e5.jpg
See image:
child_tab_img.png
child_tab_img.png (63.66 KiB) Viewed 1280 times

My question:
a) WHERE / WHAT do I need to change to force AG to use the value from the field
b) better yet: where would I need to add some code to replace all %2F in the urlencoded filename with the actual / character?


Thanks a lot
Olaf


User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1202
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Link to thumbnail - urlencode problem

Post by onoehring » 2024-05-14 15:19

Hi,

I am still investigating in this.
I stumbled upon another strange thing / problem.
I have a table that shows images in the child section (name it: t_w_child with child 'image_direkt'), but I also have a table where I can directly see those images (name it: image_direkt).

I see, I can edit the design for the TV with the files image_direkt_TV and image_direkt_TVS from the /templates folder. Here the following two rules apply:
TV is used in general for all, but the current selected record
TVS is applied to the selected record only

I saw, that the child area of the t_w_child table uses the same - but completely different code in the browser output.
By the same I mean it looks pretty much like the out put from the image_direkt table, but some things are different:

image_direkt table:

Code: Select all

<tr data-id="5481">
    <td class="text-center"><input class="hidden-print record_selector" type="checkbox" id="record_selector_5481"
            name="record_selector[]" value="5481"></td>
    <!-- Edit this file to change the layout of each record in the table view -->
    <!-- To disable clicking of a field, remove the <a onclick="document.myform.SelectedField.value = this.parentNode.cellIndex; document.myform.SelectedID.value = '5481'; document.myform.submit(); return false;" href="myimages_view.php?SelectedID=5481" style="display: block; padding:0px;"> and </a> formatters around it-->

    <!-- If you wish to hide the table view header that contains the column titles, -->
    <!-- add the following to the myimages_init() hook (in hooks/myimages.php file) -->
    <!--     $options->ShowTableHeader = 0;     -->

    <td id="myimages-ID_Container-5481" class="myimages-ID_Container"><a
            href="/hooks/containerIDfromName.php?containercode=40409355"
            style="display: block; padding:0px;">40409355</a></td>
    <td id="myimages-Bild_Datei-5481" class="myimages-Bild_Datei"><a
            href="images/481/3567b318bb07348e5.jpg" data-lightbox="myimages-Bild_Datei"><img
                src="thumbnail.php?i=481/3567b318bb07348e5.jpg&amp;t=myimages&amp;f=Bild_Datei&amp;v=tv"
                class="img-thumbnail"></a></td>
    <td id="myimages-Bild_Bemerkung-5481" class="myimages-Bild_Bemerkung">TASTTASTTAST<a
            onclick="document.myform.SelectedField.value = this.parentNode.cellIndex; document.myform.SelectedID.value = '5481'; document.myform.submit(); return false;"
            href="myimages_view.php?SelectedID=5481" style="display: block; padding:0px;">When you are
            dead.jpg</a></td>
    <td id="myimages-Log_Edit_Zeit-5481" class="myimages-Log_Edit_Zeit">&nbsp;</td>
    <td id="myimages-Log_LetzerBearbeiter-5481" class="myimages-Log_LetzerBearbeiter">&nbsp;
    </td>
    <td id="myimages-Log_Create_Zeit-5481" class="myimages-Log_Create_Zeit"><a
            onclick="document.myform.SelectedField.value = this.parentNode.cellIndex; document.myform.SelectedID.value = '5481'; document.myform.submit(); return false;"
            href="myimages_view.php?SelectedID=5481" style="display: block; padding:0px;">2024-04-18
            09:10:36</a></td>
    <td id="myimages-Log_Ersteller-5481" class="myimages-Log_Ersteller"><a
            onclick="document.myform.SelectedField.value = this.parentNode.cellIndex; document.myform.SelectedID.value = '5481'; document.myform.submit(); return false;"
            href="myimages_view.php?SelectedID=5481" style="display: block; padding:0px;">myUserName</a></td>
    <script>$j(function () {
            var e_Bild_Datei = '481/3567b318bb07348e5.jpg'; if (e_Bild_Datei == '' || e_Bild_Datei == '&nbsp;') $j(/*<*/ '#myimages-Bild_Datei-5481' /*>*/).html('');
        });</script>
</tr>
child area 'image_direkt' in the t_w_child table:

Code: Select all

<tr data-id="5481">
    <td class="text-center view-on-click"><a href="#"
            onclick="myimagesID_ContainerGetRecords({ Verb: 'open', ChildID: '5481'}); return false;"
            class="h6"><i class="glyphicon glyphicon-new-window hspacer-md"></i></a></td>

    <td class="myimages-ID_Container" id="myimages-ID_Container-5481">40409355</td>
    <td class="myimages-Bild_Datei" id="myimages-Bild_Datei-5481"><a
            href="images/481%2F3567b318bb07348e5.jpg" data-lightbox="myimages-Bild_Datei"><img
                src="thumbnail.php?i=481%2F3567b318bb07348e5.jpg&amp;t=myimages&amp;f=Bild_Datei&amp;v=tv"
                class="img-thumbnail"></a></td>
    <td class="myimages-Bild_Bemerkung" id="myimages-Bild_Bemerkung-5481">When you are
        dead.jpg</td>
    <td class="myimages-Log_Edit_Zeit" id="myimages-Log_Edit_Zeit-5481"></td>
    <td class="myimages-Log_LetzerBearbeiter" id="myimages-Log_LetzerBearbeiter-5481"></td>
    <td class="myimages-Log_Create_Zeit" id="myimages-Log_Create_Zeit-5481">2024-04-18
        09:10:36</td>
    <td class="myimages-Log_Ersteller" id="myimages-Log_Ersteller-5481">myUserName</td>
</tr>
The latter code does NOT work: When I click on the linked (and displayed!) thumbnail, somewhere in the page rendering at the server side (I suppose) the filenamefield has been changed (URLencoded) from

Code: Select all

481/3567b318bb07348e5.jpg

to

Code: Select all

481%2F3567b318bb07348e5.jpg

I would probably be able to intercept the change from

Code: Select all

/
to

Code: Select all

%2F
IF I would know where AG takes the base code from.

In my tests:
display direct (TV, image_direkt_view.php): /templates/image_direkt_TV.html IS used
display as CHILD: /templates/image_direkt_TV.html is NOT used

Question
1) Where does AG take the code to layout the CHILDdren page from?
2) Why are stand-alone records and the same as child handled in a different way?

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1202
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Link to thumbnail - urlencode problem

Post by onoehring » 2024-05-14 15:25

oops, maybe I found it:

Code: Select all

/templates/children-t_w_child.php
... still any help VERY MUCH appreciated

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1202
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Link to thumbnail - urlencode problem

Post by onoehring » 2024-05-14 16:33

Hi,
just as an update: yes, that's the place
and: my MPU script seems to be working now. Stay tuned.

Olaf


Post Reply