I am using timthumb to present images inside a Wordpress theme. It works fine when showing images from the same server but as soon as I try to load external images (in this case youtube thumbnails) it returns a 404 as if the script itself couldn't be found. The script is there though, if I load local images it behaves as expected. I have t set to allow external images, and specifically those from img.youtube.com
The strange thing is the exact same theme works as expected on my localhost and the external images show up fine, so I'm guessing it's something wrong on the hosting. Any suggestions as to what this may be?
IS your host allows to load images from external source. means out side of server ? This may be a problem.
HostGator do not allow absolute paths to use with TimThumb (even if it's hosted in your own account) as described in this article: http://support.hostgator.com/articles/specialized-help/technical/timthumb-basics.
To fix the absolute path issue, you'll would need to hack your theme functions to strip off your domain from the image path:
$url = "/path/to/timthumb.php?src=" . str_replace(site_url(), '', $path_to_image);
Related
This should be so simple but I'm a bit stumped as to the best way to approach this.
I am building a PHP plugin so I can't hard code any paths. I also need to consider http protocols (http / https). I use GD Lib to create and save an image. My directory structure looks like this:
public_html > php_plugin > php_classes > php_class.php
public_html > php_plugin > saved_images
The plugin is installed in public_html. I run code to save the image in php_class.php. Here I save the image like so: '../saved_images/imagename.jpg'. This works fine and the image is saved in the correct directory.
I then return this path via AJAX to display the image. And, obviously this path fails to resolve and I get a broken image link: http://www.website.com/saved_images/imagename.jpg
It should look like: http://www.website.com/php_plugin/saved_images/imagename.jpg
So in my PHP class where I set up the save path how do I build up a path that I can return with AJAX, bearing in mind this is a plugin and could be used on many different sites.
EDIT:
For the record I know I can use $_SERVER['SERVER_NAME'] and $_SERVER['SERVER_PROTOCOL'] but based on these SO questions (PHP $_SERVER['HTTP_HOST'] vs. $_SERVER['SERVER_NAME'], am I understanding the man pages correctly? and PHP Get Site URL Protocol - http vs https) I think this approach will be quite unreliable as the server configs where the plugin will be hosted will be an unknown.
You are conflating two different types of path; the server filesystem path and the URL path. In your case they are similar, but depending on the server configuration these might be wildly different.
Since you write that you return a path to the image via AJAX, presumably your AJAX code must know the URL to the PHP script to be able to call it (something like http://example.com/php_plugin/index.php?). In this case you could just have PHP return only the filename and provide the rest of the path in your javascript.
I'm using Codesleeve/asset pipeline on my Laravel project to serve css, js and image files. It on the whole works fine but there is an issue with displaying css-loaded images. The image does not display and shows the browser's "broken image" symbol when loading it directly (http://art.ipscap.com/assets/select2.png for example): e.g.
Upon inspecting the page it shows the image is loaded successfully with 200 OK status (or cached) but there seems to be an error displaying it. Seeing as the image in question displays fine on my local machine and the problem is only in production is there a way to diagnose this issue?
Edit: Still haven' t managed to find a solution for this. For reference the live broken image url is https://art.ipscap.com/assets/select2.png. The image itself is in app/assets/images/select2.png and the readme in the same directory states:
If you place an image here called foobar.png then you can access that image by going to http://<hostname>/assets/foobar.png
I find it strange as the image does not fail to load but is being broken by asset pipeline. The same does not seem to occur to other images in the app such as the header jpeg image.
Do you use different server software on your local and production server? I see the production uses nginx. In that case, you might have to add something to your config as stated here:
https://github.com/CodeSleeve/asset-pipeline#can-i-use-nginx
I have recently installed Magento and am using it for the first time. I am trying to uplaod an image to a folder as the new logo in the heading. When I upload the image using FTP the file uploads successfully but I can’t see it in the folder listing in a browser or on the website or if I visit the url for the image. I get a 404 page instead. Everything is getting cached I believe. I have turned off caching in the back end and cleaned out var/cache folder. This is a new one to me as I wouldn’t ahve thoughts ftp uploading an image would or could be cached? I can’t even change the header image on my website.
Im using the hellowired them as a starting point.
Cheers
Check the permissions on the Images and the directory it is in.
Can you verify that it is in the folder that you have uploaded it too?
Can you view it on server browsing the directories?
Finally check that you have type it correctly as Linux box's are CAPS sensitive, this could be why you can't see it also.
Looks like my host migrated my accounts to another server and I was actually updating the old hosting. Thanks for your help.
I finished a project using the Finesse Wordpress theme from Ixtendo several months ago and all was well. However, recently I've noticed that an image that is hard-coded in to footer.php no longer displays, instead all I see is the alt text.
I've also tried using the image as a background image to a div which doesn't work either.
Anyone know how to fix this?
Some further info in case it's useful. I had also hard-coded references to JS files in header.php which worked for a few months but then the theme stopped getting the links. I resolved this by installing a plugin called WP Headmaster which enqueues the JS in to the theme.
Thanks in advance for any help.
This will most likely be that the image location is specified relatively.
If you copied the location from the css file, the relative location will probably not have been changed.
You can verify this by right clicking on the image in google chrome/other capable browser, and selecting "open image in new tab". There you will see the absolute URL - which is probably incorrect.
A simple answer in the end.
We have a hosting account, e.g myhosting.com. The Wordpress site is loaded in to a directory called 'abc' within the main hosting account.
There is a domain name pointing at this directory, e.g. mydomain.com. The problem came from me using myhosting.com/abc/images/logo.jpg when I should have been using mydomain.com/images/logo.jpg
I obtained the correct URL via the media manager in Wordpress.
I'm having trouble with missing images on my server.
I have been developing a site locally using MAMP for a while and now that I have uploaded it to my server the images cannot be found. Firebug tells me "Failed to load the given URL".
The file structure is the exact same as it was locally and the code is also the same.
The php file trying to load the images is in the site's root folder along with the folder "images".
Here is the file structure: images/models/dreadfinsl1.jpg
Here is the page: http://eoghanoloughlin.net/george/index.php
Can anyone help me? It seems like it would be just one of those stupid problems / simple answers but I'm relatively new to this don't have much experience. It was working fine when I was using MAMP.
Looks like your in the /george/ map on the server, and i assume locally u used www/
try /george/images/models/dreadfinsl1.jpg
else you will have to use full path http://eoghanoloughlin.net/george/images/models/dreadfinsl1.jpg
Try to access an image which is in your server with the help of web browser by specifying absolute path of the image....
Like http://eoghanoloughlin.net/images/models/dreadfinsl1.jpg
If you found any image on the browser, try to display the same image on your index page...
I think specifying the file path is being a problem in your application....