CUTR-at-USF / usf-mobullity

USF Maps responsive web application
http://maps.usf.edu/
8 stars 7 forks source link

Unused Images #116

Open jailby opened 8 years ago

jailby commented 8 years ago

In the folder src/client/images that contain all images, some images seem to not be used anymore.

For example: https://github.com/CUTR-at-USF/usf-mobullity/blob/mobullityrebase/src/client/images/otp_logo_40px.png https://github.com/CUTR-at-USF/usf-mobullity/blob/mobullityrebase/src/client/images/otp_logo_darkbg_40px.png

Unless I am wrong these two are upstream images not used in our implementation.

Solution Cleaning up useless images would be a good thing.

jmfield2 commented 8 years ago

Using find/grep/comm, I found a list of about 70 images that don't appear to be used anywhere in the project. There were some leaflet images that were not found but yet are used either because of a CDN or the filename isn't exactly found in a file.

The scripts to generate the list of files:

find . -type f | egrep "jpg|png|gif|ico" |sort | uniq >imageslist.txt 

for x in `cat imageslist.txt`; do echo "$x"; find . -type f -name \*.css -exec grep -li `basename "$x"` {} +; done >css.txt
for x in `cat imageslist.txt`; do echo "$x"; find . -type f -name \*.js -exec grep -li `basename "$x"` {} +; done >js.txt
for x in `cat imageslist.txt`; do echo "$x"; find . -type f -name \*.html -exec grep -li `basename "$x"` {} +; done >html.txt

then the css,js,html.txt will have each image file followed by the files in which it was found - I manually removed those from each file and saved as found1, 2, 3.

cat found1.txt | sort | uniq >f && mv f found1.txt
# the same for found2, 3

comm -3 imageslist.txt found1 >>used
comm -3 imageslist.txt found2 >>used
comm -3 imageslist.txt found3 >>used

used1.txt

This just needs to be double-checked before moving forward and removing the images... in particular, I'm not 100% certain about the images/directions ... I thought those are being used by the trip planner but maybe not.

jailby commented 8 years ago

I thought some of the images/directions were used for the itinerary returned.

That's a good a way to find out a massive number of image that might not be used.