I have an image gallery with images and their links set up like so:
<a href="xxx/wp-content/uploads/2011/11/DSC0133.jpg" rel="attachment wp-att-367">
<img src="xxx/wp-content/uploads/2011/11/DSC0133-199x300.jpg" alt="" title="DSC0133" width="199" height="300" class="alignnone size-medium wp-image-367" />
</a>
When I do a “Just replace the file” using another .jpg file only the thumbnail is replaced, but the link to the full-size file leads back to old image. Shouldn’t the plugin change the full-size image as well as the thumbnail version?
I’m using lightbox that’s why I need the hyperlinks to the fullsize images.
I’m having difficulty locating the cause of this bug. It is most likely due to differences in paths between Windows servers and UNIX servers. I am using WP:s internal functions for locating upload paths, so is there any possibility that you have something extra weird set up on your side?
I thought so too, initially, but all my paths are set properly. The replacement of the thumbs happens flawlessly, but the full size image is never created.
What function are you using to determine the upload path? Maybe I can use that to determine if any paths are indeed incorrect.
Here is the function call I’m making:
$current_file = get_attached_file((int) $_POST[“ID”], true);
And then to move the new file to the old location:
move_uploaded_file($_FILES[“userfile”][“tmp_name”], $current_file);
If I echo the $current_file after get_attached_file, this is what it gives me:
C:\inetpub\development/content/uploads/2012/03/Chan-Lawrence.jpg
Strange, you are getting mixed slashes and backslashes, and this is your problem.
Interesting development: Instead of giving me a 404 error on the images, it gives me a 500 (a distinction I must have missed earlier).
Upon looking closer at the file system:
From my computer (a remote machine), it does not show the full-size images.
From the server, it shows them, but any attempt to view them causes an “Access denied” error.
Digging deeper, The permissions on the original file are getting changed, such that they’re not viewable by IIS_IUSRS. If I set it to read and Execute, the file is then viewable.
In the upload.php file, I noticed that you’re using a chmod command (chmod($current_file, 0644)) to change the files permissions. This seems to be the culprit, because commenting it out and trying another replacement allows the process to work properly.
Perhaps a check for the server OS would be in order to prevent chmod’ing of the file on Windows.
Upon closer inspection, my problem is different from Aaron’s and likely not caused by the same bug. I’m running Red Hat 4.1.2 and the problem is not with file permissions but that only the thumbnail image is replaced not the full sized image.
Should I start a new thread?
Hi Aaron, did you ever resolve this problem? If so, do you have specifics on HOW?
I’m working on a site that the client is hosting on Windows/IIS and am having a similar problem. The thumbnails are replaced, but the full size image is not. Not only is it not replaced, but there must be some permission errors because my prettyPhoto gallery spits out a message saying the image does not exist. The weird thing is that if I go directly to the image link in my browser, it DOES display the image (although it’s the old one) so it must be some kind of permission thing. Unfortunately I do not have direct access to the client’s server so cannot take a look at what’s going on.
Any clues?
thanks
Mike