This topic is locked

Problem with the order in which photos are displayed on the preview

1/22/2021 1:29:38 PM
PHPRunner General questions
kanclerz author

Welcome

I built a simple photo presentation application. A single record is data plus a field with photos. There are many photos, all of them are saved in jpg format and have names for example 35_1813_0_2.4_1_0000, 35_1813_0_2.4_1_0001, 35_1813_0_2.4_1_0002, 35_1813_0_2.4_1_0003 ..... In the database for storing file descriptions I chose the field with the value "mediumtext". After selecting the files and uploading them, unfortunately, they do not fit when browsing 35_1813_0_2.4_1_0000, 35_1813_0_2.4_1_0001, 35_1813_0_2.4_1_0002, 35_1813_0_2.4_1_0003 only every dozen or so files random shifts e.g. 35_18_1_2.4_1_0020, 35_1813_0_2.4_1_0022, 35_1813_0_2.4_1_0023, 35_1813_0_2.4_1_0028, 35_1813_0_2.4_1_0024 35_1813_0_2.4_1_0026 .... What am I doing wrong with this application that the files don't want to stack up when browsing.

S
salus1DevClub member 1/23/2021

You could put something like this, listing your images, in the text field...
<img src="apiforms/mobile1.gif" width="100%" height="auto">
<img src="apiforms/mobile2.gif" width="100%" height="auto">
<img src="apiforms/mobile3.gif" width="100%" height="auto">
<img src="apiforms/mobile4.gif" width="100%" height="auto">
...and set the View As selection to HTML without truncation.

S
salus1DevClub member 1/24/2021

I didn't read this correctly the first time and, when I revisited it, came away with another question. When an image is uploaded as a file PHPRunner adds a suffix (like "_lv020ujx" in the example below) to the original file name ("BBLLT4j.jpg" below) before writing the file to disk.
{"name":"files\/BBLLT4j_lv020ujx.jpg","usrName":"BBLLT4j.jpg","size":59776,"type":"image\/jpeg","thumbnail":"files\/thBBLLT4j_d79qt2gf.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":2549}
Is there a way to disable this renaming feature so the file written to disk remains "BBLLT4j.jpg" and the thumbnail "thBBLLT4j.jpg", overwriting previously uploaded versions? The image could then be referenced reliably by URL like "https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=93659&image=1&table=forumreplies";
Thanks
BTW I didn't even know you could add multiple images using this method prior to looking in to this, always used the BLOB method for images. Yet another amazing PHP Runner capability!

kanclerz author 1/24/2021

When creating the application, I followed the tutorial at https://www.youtube.com/watch?v=RD8Au0h_CpE. So I wonder if the problem is not that the system transfers files unevenly, e.g. 2, 4,5,6,8,10,11 ... and at the same time saves them in the database.

S
salus1DevClub member 1/24/2021

I added 15 images to a field and copied the result below from the database. Looks like the images and searchStr values are in a different order than as loaded. Not sure if this has anything to do with your issue, just an observation.
[

{"name":"files\/img001_y4ypdem3.jpg","usrName":"img001.jpg","size":39888,"type":"image\/jpeg","thumbnail":"files\/thimg001_9x5jgbem.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":2496,"searchStr":"img001.jpg,!img002.jpg,!img004.jpg,!img003.jpg,!img007.jpg,!img006.jpg,!img005.jpg,!img014.jpg,!img008.jpg,!img009.jpg,!img011.jpg,!img015.jpg,!img012.jpg,!img010.jpg,!img013.jpg,!:sStrEnd"},

{"name":"files\/img002_03gl72i8.jpg","usrName":"img002.jpg","size":40662,"type":"image\/jpeg","thumbnail":"files\/thimg002_robxxgwt.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":2534},

{"name":"files\/img004_xmrlprac.jpg","usrName":"img004.jpg","size":30455,"type":"image\/jpeg","thumbnail":"files\/thimg004_f92fo3dq.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":2206},

{"name":"files\/img003_i899y5zz.jpg","usrName":"img003.jpg","size":38848,"type":"image\/jpeg","thumbnail":"files\/thimg003_awsdacol.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":2369},

{"name":"files\/img007_k5qapy7n.jpg","usrName":"img007.jpg","size":33131,"type":"image\/jpeg","thumbnail":"files\/thimg007_z0zusonu.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":2106},

{"name":"files\/img006_k37h8o98.jpg","usrName":"img006.jpg","size":31306,"type":"image\/jpeg","thumbnail":"files\/thimg006_18076ax5.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":2443},

{"name":"files\/img005_kpwu77es.jpg","usrName":"img005.jpg","size":44263,"type":"image\/jpeg","thumbnail":"files\/thimg005_m690xm9i.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":2807},

{"name":"files\/img014_eelbmf52.jpg","usrName":"img014.jpg","size":37109,"type":"image\/jpeg","thumbnail":"files\/thimg014_ipfp8vsc.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":2008},

{"name":"files\/img008_jkhjwul8.jpg","usrName":"img008.jpg","size":43178,"type":"image\/jpeg","thumbnail":"files\/thimg008_6hlydhqq.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":2678},

{"name":"files\/img009_5k2hd2kh.jpg","usrName":"img009.jpg","size":35825,"type":"image\/jpeg","thumbnail":"files\/thimg009_6qhubkg9.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":2136},

{"name":"files\/img011_tvvj6f1h.jpg","usrName":"img011.jpg","size":73191,"type":"image\/jpeg","thumbnail":"files\/thimg011_dtgy2u5o.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":2378},

{"name":"files\/img015_ygssuda6.jpg","usrName":"img015.jpg","size":66873,"type":"image\/jpeg","thumbnail":"files\/thimg015_0jwsotpy.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":3307},

{"name":"files\/img012_wrw4b2rn.jpg","usrName":"img012.jpg","size":82916,"type":"image\/jpeg","thumbnail":"files\/thimg012_9o8t482x.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":2593},

{"name":"files\/img010_2gxi353u.jpg","usrName":"img010.jpg","size":78021,"type":"image\/jpeg","thumbnail":"files\/thimg010_c66z5vlx.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":2794},

{"name":"files\/img013_awaei61t.jpg","usrName":"img013.jpg","size":37418,"type":"image\/jpeg","thumbnail":"files\/thimg013_8shd8hs5.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":1842}]