Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About JohnnyDoomo

  • Rank
    Regular Member

Profile Information

  • Gender
    Not Telling
  1. I'm using php code I got from StackOverload that looks like this: <?php // Some URL for testing $url = 'https://www.google.de/favicon.ico'; // Time to cache the files (here: 10 minutes) define('time_to_cache', 600); // Create a local file representation $local = './cache/' . urlencode($url); // Determine whether the local file is too old if (@filemtime($local) + time_to_cache < time()) { // Download a fresh copy copy ($url, $local); // Store headers in case we need them (see alternative below) file_put_contents($local . '.hdr', join($http_response_header, "\n")); } // Solution 1: Redirect to the local cache file header('Location: ' . urlencode($local)); exit(); // Alternative: Send headers and the actual file // Note that this might cause problems, e.g. due // to cache fields and the like. // Read and send headers foreach(file($local . '.hdr') as $line) header($line); // Read and send the actual file readfile($local); ?> I've remarked out the "solution 1" lines, because that method doesn't work at all on my server. The alternative works, except for an https problem. I'm loading a bunch of images from 3rd party sites. My site is only https, and I want to keep all local images using https. I have lazyloading js applied to all images that load on the page, and when I use the above php, as I scroll down my page, my browser https lock will turn to unsecure. So I can assume, that lots of the images are loading properly from https, and then suddenly, it loads an image from http instead of https. So for some reason, the above php is not keeping my https, despite that the script looks to only call the image from my local location. I'm fairly new to learning php, but am I missing something here? From what I can see from the "readfile" line, all images should be shown from my cached area, which I've already stated as https, and have tried both "//" and specifically hardcoding "https" into the img src, but I still get these problems, where as I scroll down the page, the browser https secure lock will change to the mixed content, indicating that the browser has just loaded something NOT from https. Can anybody help me with what I need to add, so that the above code either keeps my secure protocol or doesn't try to load the image if it's not from https? Any help would be appreciated!
  2. My image gallery creates folders that look like this: thumbnail: http://blah.com/data/99999/thumbs/abc.jpg medium: http://blah.com/data/99999/medium/abc.jpg original: http://blah.com/data/99999/abc.jpg The script dynamically creates new folder IDs where the "99999" are. I would like the .htaccess file to allow the /thumbs/ and /medium/ folders to always allow hotlinking, but I want to protect the fullsize image and replace it with the medium image if it's ever coming from a domain other than my blah.com. I cannot create an htaccess file for every ID folder, so I need an htaccess rule that wildcards the ID folder, and sits in /data/. Can anybody help with the code required to do this? Or is something like this not possible until I get the fullsized images OUTSIDE of the folder where the thumbnails, and medium sized images are? I have very little knowledge of htaccess, so the exact code I can paste is greatly appreciated. Thanks for any help you can provide.
  3. I have a script that the developer has stopped supporting. The script has the ability to mark images "mature", but only single images, and one by one. The script has no ability to mark an entire category mature. Is what I want to do is perform a mysql command in phpmyadmin that tells it to auto change the setting for all images in a category to be marked as mature. Can someone help me with what command I would use to do this? My database name: site_database Category table: pp_categories How cats are identified: "catorder" Photo table: pp_photos How photos are identified as being in the same category: "cat" table that I need to change: "ismature" So I was hoping for a command that I can insert into phpmyadmin, to say all images within a certain category id, change the photos table of "ismature" to 1. From my understanding of the script, this would then mark all the photos in that album on the site as mature. Can anybody help me with what I would need to type in?
  4. I have a page that has an input field that requests a full url. This includes everything from the http:// to multiple directories into the site. So something similar to http://blah.com/blah/blah/test.jpg I am trying to pass this url to next page's url. So when you submit this form, the following page is http://mysite.com/?http://blah.com/blah/blah/test.jpg?blah1=1?blah2=2?blah3=3 The problem is, the url always appears like this in the following page: http://mysite.com?http%3A%2F%blah.com%2Fblah%2Fblah%2Ftest.jpg?blah1=1 I need this changed so that it shows properly. I'm new to php, and need this done in php, not javascript. I need the output or proceeding url to look like http://mysite.com/?http://blah.com/blah/blah/test.jpg I've looked into rawurl/de/encode the get variable and nothing works, as far as getting it to be what is shown in the browser url bar. This is causing me a huge headache, and no matter what I search for in Google, I can't find anything that will allow me to alter a get request BEFORE it's set to the following page, after the submit button has been clicked, but not just change the variable that the get request got, but for what it actually shows in the url field, when calling that get request. Am I going about this wrong? Am I asking for something that can/shouldn't be done? I searched high and low on stackoverflow and still nothing helps with this exact problem I'm having. I've tried stripping the http:// out of the get variable and then inserting that variable without the http:// behind my hard typed site like: http://mysite.com?http://$url but I can only echo that, I can't make that be what is actually in the url bar. Any help on this would be appreciated. If you can make your instructions very basic, that would be extremely helpful, as I am just barely learning get requests and how to pass them onto other pages.
  5. I'm very new to php, and I'm trying to keep ampersands from changing from & to & I have a url that contains multiple ampersands. I'm trying to hand this variable off to an API line for a local url shortener script. However, the url shortener isn't working, and when I check what it has put into the mysql database, it's saving the url with & instead of &. The page after submitting the form contains ampersands. On that page is the link for the same page, but being processed by the url shortener. This is the link that is wrong. I've echo'ed out my variable I'm handing the API and the echo shows ampersands, and I've even checked the source of the html page where the echo is being displayed, and even in the source code, it shows ampersands not & But when I check the db, the insertion for that short url page, has the page under the correct long url, but all ampersands are switched to & Do I need to do something more with my variable before handing it to the API? Do I need to contact the url shortner programmer? Is there something I can search for in the url shortener script, to keep it from "cleaning" my urls I hand it? Could this be some server setting that is causing this issue? Any help on this problem would be greatly appreciated, thanks.
  6. I'm attempting to use the preloader from here: https://www.niklausgerber.com/blog/preloadme-a-lightweight-jquery-website-preloader My problem is that I have a line that includes a php file. This php line goes out and grabs rss feeds from other sites, and it takes roughly 10 seconds to process. My problem is, when using the above mentioned preloader, the page sits for the time it takes for the php to process, then quickly flashes the preloader, and then the site that uses the gathered rss info. I don't know php or JS, but want to get this to work, so that the JS lines and page show, while that include statement is loading the php, and gathering the rss info. Is there any easy way to do this, when I don't know php or JS? Any help is greatly appreciated. Thanks!
  7. I'm in the process of switching servers. My previous server was both hosted, and managed, but I'm moving to an in-house server, that is only managed. All accounts on the server our mine, and I'm not a reseller. I have sites that I need to run on different versions of php, and I even have lines that exist in my .htaccess files that look similar to this: AddHandler application/x-httpd-php52 .php I want the new management company to make it so these same lines work, and tell the specific site to run on php version 5.2. I've tried to explain to them what I want done, but I'm not getting anywhere with them. The server is already setup with CentOS, Apache, and a form of Nginx, and cpanel. Can someone help me with what module, package, etc. that I need to ask them to install or setup, so that I can get these lines to work in my .htaccess files? Thanks for any help!
  8. 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!
  • 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.