Croppic / php - uploaded image not showing on localhost
I am using Croppic to allow the user to upload and crop a profile picture. My code is copied from the site, so it is identical. However, when I run it on my local machine, the downloaded image does not appear. I get a JSON 200 response and the path to the uploaded image, but the image is not showing. To confuse things, if I physically navigate to the folder where the images are loaded and try to open it, I get a message in the Windows Photo Viewer
"Windows Photo Viewer cannot open this image because you do not have the correct permissions to access the file location."
... even though I own the folder and have all the correct permissions (windows 7).
Any ideas what is going wrong?
<style>
#profilePicFrame{
width: 200px;
height: 150px;
padding: 2px;
border: 1px solid silver;
position: relative;
}
</style>
<div id = "profilePicFrame">
<i class = "loader"></i>
</div>
<script>
$(document).ready(function() {
var cropperOptions = {
uploadUrl:'/assets/croppic/img_save_to_file.php',
cropUrl:'/assets/croppic/img_crop_to_file.php',
imgEyecandy:true,
imgEyecandyOpacity:0.2
};
var cropperHeader = new Croppic('profilePicFrame', cropperOptions);
});
</script>
Edit:
I did some more research and found that if I navigate to the folder where the thumbnail is loaded, the thumbnail is not displayed and opening it in the Windows Photo Viewer just displays the above permission error. But if I right clicked, I get a message that I need administrator rights to change security settings - click OK and then see that my Windows user is not listed under Security. System and administrators only. I thought I was the only user on this system, I was an administrator, at least I have administrator rights, since I can change the settings. If I manually add my windows user to the full access rights list,then i can view the image in windows photo viewer.
So why is the image being created without user rights to view it?
source to share
Some operating systems can be a little funny, especially when working with apache.
I assume, as you mentioned using PHP, that you infact works with apache.
When you link to something using * nix or another OS running apache, make sure you link your files correctly.
Apache speaking, your uploadURL and cropURL are in / assets / etc / etc / script.php, this might fall back to root, especially on a * nix system, you have to be very careful about referencing other scripts - hence can't see them?
I also assume that you used the same file reference in your PHP script, will surely fail, as it will try to write a file that Apache has NOT , permissions to do so without any heavier modification.
source to share