News:

Thanks to everyone for the feedback on what errors you encountered from the forum database changes made in Fall 2023. Let us know if you discover anymore.

Main Menu

Updating the NYSRoads Photo Gallery

Started by vdeane, December 08, 2019, 09:08:44 PM

Previous topic - Next topic

vdeane

So, I've been thinking for a while that I'd like to improve how photos are displayed on my website (nysroads.com).  Right now the thumbnails for a route are just all arranged by filename (which I've been manually editing for a few years now with terminal batch renamings to avoid duplication) as a workaround for sorting by date (which mostly works, aside from a small number of photos for NY 590 and NY 104 that were taken with Mom's camera).  If one clicks on a thumbnail, they get a page with a larger image displaying the state, route, and date (the latter by taking it from the photo metadata - it's not stored in the database as I haven't figured out an easy way to do so).  That's about it.

I'd like to do more.  This is very not ideal, especially since I was originally inspired by sites like AARoads and CanHighways (now AsphaltPlanet) that do much more.  I actually did code in all that originally (some of which survives as a college class project that served as a template for my site's gallery), but I only got a fraction of the way in to adding photos before realizing that it would be way too much work to continue this way and that I'd have a very large backlog forever.  I had only gotten through 2007 and maybe 2008 (both years where I took a lot less photos than usual due to a combination of still being in high school and not yet having decided to take pictures of every sign) before the task got overwhelming.  That was 2013.  Naturally, I have a lot more photos now.

The way it works is I have four command-line scripts that I use to mostly automate upload.  convert.pl (yes, the is in Perl; my course was in that language so that's what was convenient for command-line database additions) goes through the directory and takes the raw photos copied in and resizes it to 800x600 with a thumbnail copy at 200x150 with imagemagick.  Then I copy everything to my web host where the other three scripts come into play: state.pl for when I need to add a new state, route.pl for adding routes, and add.pl which iterates through the folder and adds all photos not yet added to the database (back when I self-hosted it includes convert.pl, but that was split off in the name of keeping mirrored copies of my website on my computer and on the server for backup purposes).

Naturally, the problem with this is that it can be hard to find things if photos were taken over multiple trips.  Just this week I had a hard time finding a photo on the I-90 portion of the Thruway to reference here; I must have passed it 10 times going up and down the page to try to find it, since everything is sliced and diced seemingly randomly, relying on my own memory of what photos were taken in which trips and when to find anything.  This is a big issue for New York in particular, especially around Rochester and Albany and everything in between.  I'd like to be able to change that, but I'm not sure how to do so in a way that would keep the workload reasonable.  The original system involved add.pl working more like route.pl and state.pl, feeding in command-line arguments for each and every photo one at a time.

You might be wondering, why command-line scripts?  It's because it was easy to code and easy to secure.  Forms would still be just as much work (at least at the level I know how to code, since what I made for that class project was just a web front-end for what my original add.pl looked like), and I'd have to figure out some way to keep everything secure (I don't currently have HTTPS, though I think that can be added for free).  I'd like to add direction (EB, WB, NB, SB, and "Related"), milepoint or some other way to properly sort everything by location on the route, and a description (which I probably wouldn't need for most but would be useful for some).  The date would be nice but not required (would mainly be useful for photos taken when my camera resets date and time and I don't have a chance to set them properly first; right now I have to go into Windows to edit that, but I won't have the ability to do that forever as Windows 7 hits end of life in a month).  I think my original system also had photographer, but that's not really necessary since all the photos are mine.

Any ideas?  I could probably get away with just doing this for New York (with an "uncategorized" "direction" that sorts by file name as a fall-back mode) since that's my site's main focus, but that's still a lot of work.
Please note: All comments here represent my own personal opinion and do not reflect the official position of NYSDOT or its affiliates.


dgolub

My file naming scheme is route number, direction, exit number, sequence number.  For example 495e36_02 is I-495 east at exit 36, the second picture at that exit.  For roads that don't have exit numbers, I just leave out the exit number and have sequence numbers that cover the entire length of the road, e.g. 25e00246.  I've got a tool I've written that can automatically rename files for when I want to insert pictures between two sequence numbers.

vdeane

Right now I'm thinking of creating a meta.pl file that loops through the files similar to add.pl and prompts for information for anything without a direction set.  Maybe having a loop of prompts will be a lot less work than passing command line arguments one at a time.  Something to look at in the new year, anyways.
Please note: All comments here represent my own personal opinion and do not reflect the official position of NYSDOT or its affiliates.

dgolub

Sounds like a good idea.

Once you've got stuff in order, it would also be nice to have forward and back buttons to navigate through the pictures without having to go back to the thumbnails every time.

vdeane

I'll have to overhaul the page to get things like directions and descriptions includes, likely having to query the database regardless.  I can look into it.  Likely replace the existing back link, since that was created mainly for the photo gallery anyways.
Please note: All comments here represent my own personal opinion and do not reflect the official position of NYSDOT or its affiliates.

vdeane

I did some work on this today.  Ordered/direction sorting now works on the test page.  Currently, I-78, I-781, I-590/NY 590 (the flagship, at current - it has the most stark change between the old and new systems), and I-990 are done.  Others show as they currently do under "uncatagorized".  Some photos have descriptions.

Haven't figured out how I'm going to tackle previous/next buttons yet.  Debating on how/whether I want to have the title change with the page (the long titles some pages would have annoys me, but a few exit lists have the same issue, so it's not a unique issue; also, I'd have to change some of the formatting of information as the header would become redundant).  I'm also thinking of adding descriptions for the route pages.

http://nysroads.com/photos-test.php
Please note: All comments here represent my own personal opinion and do not reflect the official position of NYSDOT or its affiliates.

vdeane

#6
I've been thinking about a few of my edge cases for how to handle sequencing for the photo gallery, and was curious if anyone had any thoughts on them.
-For I-690/NY 690, I'm debating on whether to use the same sequence for the whole route under EB/WB directions (it has one milepost system, but NY 690 lacks exit numbers) or split out the NB/SB section.
-For the I-90 portion of the Thruway, I'm not quite sure how to handle it.  For most roads, I'm just using exit numbers to keep it simple, but for the Thruway, that results in a "backwards" sequence.  While that's fine now (and matches the mileposts), if NY ever converted to mile-based numbers using I-90's mileage, that would present issues.
-For I-81 and I-481, I'm thinking that I'm likely going to have to include separate pages for "historic" and "current" I-81 if/when it gets removed.  There doesn't seem to be a good way to handle it otherwise.

Thoughts?  I think I'm most torn on how to handle the Thruway.  While I originally envisioned locations based on mileage, using exit numbers is MUCH less work!

EDIT: I think I figured out how I'm going to handle I-81, and the solution happens to work for the Thruway too.  I'm going to add additional directions that are tagged "historic" that can be used in the event of a major realignment, removal, or other changes.  That way, I can put everything in normally now, and just use a database query to change everything if/when things change.  I could also use this for roads like the Inner Loop that have had portions removed.  Thankfully I had the foresight to do directions as a database table with three letter codes and up to 255 entries allowed!  I probably won't do thing for more minor things, like I-84's conversion to mile-based numbers.  Now this is making me wonder if I should change how I handled everything around the new I-95/PA Turnpike interchange.  I just moved photos to what the new roads are now... should I move them back and use historic, since most of my photos from the area are from before the change, or just leave it as-is since the physical road and interchanges aren't changed?  As always, comments/suggestions welcome!
Please note: All comments here represent my own personal opinion and do not reflect the official position of NYSDOT or its affiliates.

dgolub

Quote from: vdeane on January 29, 2020, 09:30:29 PM
I've been thinking about a few of my edge cases for how to handle sequencing for the photo gallery, and was curious if anyone had any thoughts on them.
-For I-690/NY 690, I'm debating on whether to use the same sequence for the whole route under EB/WB directions (it has one milepost system, but NY 690 lacks exit numbers) or split out the NB/SB section.
-For the I-90 portion of the Thruway, I'm not quite sure how to handle it.  For most roads, I'm just using exit numbers to keep it simple, but for the Thruway, that results in a "backwards" sequence.  While that's fine now (and matches the mileposts), if NY ever converted to mile-based numbers using I-90's mileage, that would present issues.
-For I-81 and I-481, I'm thinking that I'm likely going to have to include separate pages for "historic" and "current" I-81 if/when it gets removed.  There doesn't seem to be a good way to handle it otherwise.

Thoughts?  I think I'm most torn on how to handle the Thruway.  While I originally envisioned locations based on mileage, using exit numbers is MUCH less work!

EDIT: I think I figured out how I'm going to handle I-81, and the solution happens to work for the Thruway too.  I'm going to add additional directions that are tagged "historic" that can be used in the event of a major realignment, removal, or other changes.  That way, I can put everything in normally now, and just use a database query to change everything if/when things change.  I could also use this for roads like the Inner Loop that have had portions removed.  Thankfully I had the foresight to do directions as a database table with three letter codes and up to 255 entries allowed!  I probably won't do thing for more minor things, like I-84's conversion to mile-based numbers.  Now this is making me wonder if I should change how I handled everything around the new I-95/PA Turnpike interchange.  I just moved photos to what the new roads are now... should I move them back and use historic, since most of my photos from the area are from before the change, or just leave it as-is since the physical road and interchanges aren't changed?  As always, comments/suggestions welcome!

What I've done is to use subdirectories to handle the different sections of the road.  I haven't needed to do this with I-90 yet, but I have with I-87.  I've got Major Deegan Expressway photos in the root directory and Thruway photos in a subdirectory called Thruway.  For example, 87n09_01.jpg and thruway/87n09_01.jpg refer to the first picture from exit 9 of each section.  I'll use northway/87n09_01.jpg when I eventually get Northway photos.

I've had plenty of places to split out current vs. historic photos.  You'll find more and more stuff to archive as time goes on and things change.  My methodology for classifying pictures is to have three fields identifying a photo gallery section.  There's a direction field, which can be North, South, East, West, etc.  Then, there's an optional banner field to specify things like truck routes, business routes, alternate routes, etc.  Finally, there's a Boolean field called archived that can be used to specify that a section holds photos of things that no longer exist in the form shown.

lepidopteran

Do you have the photos tagged in the XMP metadata format?

Perhaps you could develop a new roadgeek schema for XMP, with tags like route number or direction, keywords listed like BGS's, or string arrays like ["Interstate","US","State","County"] for route type.

vdeane

Major milestone hit tonight: all of the New York state interstates are done!  I think that's about 20% of the photo volume... now the real work begins, since I can't rely on sequential exit numbers or deep knowledge make it super easy to come up with sequence numbers from this point on, and I'm probably going to need to write descriptions more frequently (especially when dealing with non-freeways).

In other news, I added a feature: the state and route names in the header are now clickable, allowing for more navigation points in the photo gallery (especially helpful if I link to a photo from here).  Given that the back button was added to make it possible to navigate the photo gallery without resorting to browser buttons, it shouldn't be needed any more.
Please note: All comments here represent my own personal opinion and do not reflect the official position of NYSDOT or its affiliates.



Opinions expressed here on belong solely to the poster and do not represent or reflect the opinions or beliefs of AARoads, its creators and/or associates.