Vlad777 / mit-stanford

MIT-Stanford MOOC mashup
2 stars 0 forks source link

Image Missing #11

Open reztic opened 11 years ago

reztic commented 11 years ago

I know a way to remove images that are not available.

One way that we can do this is using the php file_exists function. We can have an if statement to check whether the file exist otherwise just load a placeholder image.

http://php.net/manual/en/function.file-exists.php

Alicedelic commented 11 years ago

The way it is done in courseScraperSEE is that the value with the url/filename of the placeholder is default and is directly written in the database if/when a valid image is not available.

I do see this way it would be a pain in case we need to change the location or the filename of the placeholder, since that would require to change that url/filename in all entires of the database that have it (or re-run the scraper code).

So maybe we could use some other strategy that is more flexible although this one works ok as long as you don't need to move around the location of the placeholder.jpg