Jump to content

External image grabbing / caching / thumbnail script needs fixes


Recommended Posts

I have purchased a fairly simple php script (244 lines) that can cache thumbnails that are external to my domain, creates a thumbnail from them, and caches them into a folder on my domain. While the script covers most of my needs, it has some bugs I'd like fixed.

 

The script functions in this manner: http://blah.com/script.php?x=http://externaldomain.com/blah.jpg

 

Here are a list of the bugs I've noticed with the current state the script, and some corrections I'd like made in how the script functions.

 

1. The script looks to handle gifs fine, but has problems with animated gifs. (This is partially an assumption that it's the animated gifs, but could also be because of their size.)

Test animated gif it was having trouble pulling and caching: http://www.destructoid.com//ul/313047-drakegif.gif (yes, they produce their links with the double "/" in them. I've tested this with and without the double slashes, and it's not what's preventing it from working, nor can a double slash break any of your coding you add.)

 

2. The script currently has problems caching images that have certain symbols either in the url, or perhaps just the filename itself. While I specifically want certain symbols fixed, I'd like it if it could handle any possible character that could be thrown into a url path or image filename for your standard English / keyboard.

Here are a few test images I noticed the script was not able to create thumbnails for / I would want to make sure could be processed:

 

http://o.aolcdn.com/hss/storage/midas/4bc4ea0a0f7edabe0b454cfb45eda037/202716852/Logitech+G410+Atlas+Spectrum.jpg

http://www.gamasutra.com/db_area/images/news/2015/Sep/254992/Mario%20Maker%20Small.jpg (Posting this removed the %20 inbetween "Mario%20Maker%20Small")

http://www.gamasutra.com/db_area/images/news/2015/Sep/254992/Mario Maker Small.jpg (This one specifically has spaces in the filename.)

 

2a. The script seems to have trouble with image located on https. I would want this fixed.

Test image: https://my.mixtape.moe/anmwsl.jpg

 

3. The script has problems when the image it pulls already has the external site's resize code within the url path.

Test image it was having trouble with: http://i2.wp.com/venturebeat.com/wp-content/uploads/2015/06/Oculus-Touch-2.jpg?resize=800%2C450

 

3a. It has trouble pulling from this slightly more complicated url, that is also an image resizing script for the source domain.

Test image: http://o.aolcdn.com/dims-shared/dims3/GLOB/crop/4000x2375+0+291/resize/1200x713!/format/jpg/quality/85/http://hss-prod.hss.aol.com/hss/storage/midas/1fd072fd2fa5b0424b689ee19c3cdb17/202724938/486996838.jpg

 

4. The script currently puts its cached images inside it's own folder, so the script is in the same folder that has all the thumbnails. I would like this fixed, so that it puts them inside a cached folder configured in the script. This needs to be a configurable setting.

 

5. Need programmers opinion on having the script clear the cache folder itself, or if it's better to just set a server cronjob for that. If script should do it, I would need it programmed in, as it doesn't clear its folder. (One aspect of this I was thinking of, is a side script that has a cronjob call it, and it only clears images in the cache folder weren't generated in the last 48 hours. This would avoid a cronjob clearing the entire cache folder, and the most recent thumbnail caches having to be regenerated, because they're still being accessed.)

 

6. The script currently converts pngs with transparency, but makes the background of them black. I'm seeing that the outer edge of the image items seem to be white, so I want to change that to a white, or if not too much programming time is involved, then to be configurable inside the script using FFFFFF or 000000, etc. (The complete color range isn't needed, and I'm more mainly thinking white, black, and an exact gray that I could test to see if a gray worked well for both white and black outlined items inside the transparent png) (Example: When it converts this image: http://image.noelshack.com/fichiers/2015/37/1441895889-fallout-4-logo.png because it has no outline, it turns out to be a completely black thumbnail. I'd like to negate this as much as possible.)

 

 

Programming guidelines

7. No settings can be added to the line: http://blah.com/script.php?x=http://externaldomain.com/blah.jpg

I don't want urls that give some configuration details within the line itself.

 

8. All the above fixes need to be coded in a way that they work for multiple sites with these problems, and sites that have similar problems, and not the specific urls mentioned in the "test images". For example, this test image (http://i2.wp.com/venturebeat.com/wp-content/uploads/2015/06/Oculus-Touch-2.jpg?resize=800%2C450) cannot be programmed to only look for "venturebeat.com" to remove the "?resize=800%2C450" from the image path, nor can it look specifically for "?resize=800%2C450", but more importantly the possible filename extensions (.jpg .jpeg .png .gif) and remove the following data after that extension, as we may be pulling from another domain, that has a similar, but not the exact resize code after the end of the image filename.

 

 

Second Job / Separate Quote From Above

While the above items are nessasity for the script, I'm hoping to have a programmer that can not only fix the above problems, but also quote these as either an option, to either code in at the same time, or at a later date. These would be quoted after you had the source script and a chance to look it over.

 

9. Added Security - Ensure that the script can't be abused by others. (I know I can make the thumbnails in the cache folder not hotlinkable, but I'm thinking abuse of the script forcing it to bog down my server, etc.)

 

10. Add Timeout - I do not know if the script has a timeout ability, but if it does it's hardcoded. I would like this configurable, so that I could easily set a timeout, and if the external image hasn't been pulled in that amount of time, and / or if the generating of the thumbnail is taking to long, the process for that image is abandoned.

 

11. Increase Speed - Nothing that would be a complete rewrite of how the script functions, but after viewing the code, if you could see some fixes from a programming standpoint that could be used to increase the speed at which the script functions in pulling the external image, generating the thumbnail, or displaying the thumbnail.

 

 

 

Please contact me by PMing me here. I've tried to go into detail the best I could of what I want the script to be able to do. If you need more info before a price quote, please let me know. I'm looking to get a price quote for the job that includes items 1 - 8 above. I'm also only looking for a programmer that can provide proof of their skill, either a history here at phpfreaks or at a freelance site, where I can check your history / skills / rating. If you have a freelance site you use, please include it in the initial PM.

 

Thanks for reading, I hope I find someone!

Link to comment
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.