trappist
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Thumbnails not displayed on blog due to URL overwriting (I guess)Hi Mihai,
I am having a similar problem with thumbnails, although it happens on a clone copy of my website I use as a sandbox for testing purposes.
In your example the “img src” tag was altered, in my case it became empty (img src=””). As a result I see empty frames where the thumbnails should appear.
As pointed out in your example, that source path should point to thumbnails stored in the folder et_temp.After some research I found out that full size images loaded via the WP Media Library are stored in “uploads/xx”, (xx being the month) while thumbnails are stored in both “uploads/xx” and “et_temp” folders. The former contains official WP thumbnails whose size is defined in the Settings/Media menu, while the latter appears to contain thumbnails created by the theme.
The database dump I made as a backup contains only paths to the full size images uploaded to the “uploads” folder, but no references to the thumbnails. Where are the full paths to the thumbnails stored?
How do webpages get the source data (img src) to point to the correct thumbnail path in et_temp? Apparently not from the MySQL database.
Can anyone shed light on this?
Thanks for your help.
Forum: Fixing WordPress
In reply to: I cannot login into a test clone of my wordpress websiteThanks for your kind reply.
I copied files and folders via FTP. That should be quite safe, if I am not mistaken. The problem then becomes the database. I thought that updating the wp_options field in the DB with the correct url that includes the “test” folder would have sufficed, but I was wrong.I will try your suggestions as soon as I can but, if I got it right, it will not create a proper clone. The current WP version I am running is 3.4.2 and, if I make a new 1-click install, the latest version 3.5 will be installed instead. I do not want to update to the latest WP until I am 100% positive it works in the test environment (which I am struggling to setup).
I created an empty .htaccess and included the 3 lines you posted above. I then reverted to the first hyperlink (without the dwi.php routine). I tested this and it did not work, the first image opened in a new browser tab instead of calling the download dialoge box. The second called the usual empty window. I then added the “ForceType application/octet-stream” to the .htaccess script, but it did not change the result. I even copied it to both folders “large” and its subfolder “portfolio”, but no joy.
I have now reverted to the original dwi.php script and I have opened a ticket with my host. If that fails, I am afraid I have to throw in the towel and stick to the wp-content folder, at least until someone else will come across the same problem and contributes towards a fix.
I have learned a lot in these last 3 days, although at a price. I am not progressing with my website and I really need to crack on and finish it. ??
I am very grateful for all the time you have spent helping me. You truly embody the spirit of the collaborative open-source linux community.
I have been browsing the web for suggestions and found out that this issue has already been debated outside the WP community.
For example, this is a php script based solution, like the one you suggested me:
https://www.amember.com/forum/threads/force-file-downloads-with-htaccess.14980/
Unfortunately they do not mention having any folder access restriction problems.I found the fix you suggest for .htaccess discussed in a few web pages, but found no mention on how to restrict the download of image files to a single folder. Maybe something like:
<FilesMatch /large/portfolio/.*>
Order Deny,Allow
Allow from all
</FilesMatch>Hmmmm, I do not get any 500 error. I only get an empty window when I hit the download icon for both images.
I cannot see the extra “/” either.
Could you please be more specific with the line 54 code? Sorry, but I am not really familiar with this stuff. Maybe you can copy and paste the relevant parts so that I can make changes to the code.
The only script I have managed to use successfully is your first version (only for images under wp-content).
Thanks for the suggestion. Tomorrow I will contact my host and see if they can grant to the “large” folder the same permissions as wp-contents.
If they can’t help me, maybe I can open a new thread to ask if anyone can suggest a specific fix in .htaccess.I have uploaded the new script and updated the code with the link that includes the urlencode() function.
The dwi.php I was running when I sent you the link to the test page was the first version, as the second caused the 500 error. I am now using the latest you sent, but I still get the empty window.
I appreciate very much the help you are giving me, but if it gets too difficult to debug I will just keep it as it is, namely using wp-content for the download data and the faulty button. It’s not the end of the world.
I am new to WP and can now see the limits of its much-touted simplicity: as long as you build a lousy blog with twenty-eleven it’s fine. Try to customise something and you open up Pandora’s box with plenty frustration and time wasted. All this ugly stuff removes most of the pleasure to build a website.
Here is a link to a test page with 2 images:
https://www.sharemyphoto.org/#!/portfolio/I renamed your script dwi.php to have a shorter URL.
The first image can be downloaded (stored in wp-content), the second (stored in large/portfolio) fails and opens an empty window instead.
Yes, I confirm that the script calls the “Save As” dialogue box if I paste the created URL into the browser, so it’s not an issue with your script.
The URL link structure for the button is the one I pasted above.
Where do I find the “click” event for the button?I can read and display images from any folder I create at the root level, but the downloading functionality for data outside wp-content doesn’t seem to be enabled.
My .htaccess is a standard one, I think. This what it looks like:
# Begin default subdomain redirect #
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite.org
RewriteRule ^(.*)$ https://www.mysite.org/$1 [R=permanent,L]# End default subdomain redirect #
DirectoryIndex index.php
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule># END WordPress
I will check the owner:group thing, but as I said I set all to 777 as a test and it did not solve my problem.
I tried the debug script and I got the following error:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.I conducted some further tests and what I found out suggests a folder position issue, probably connected to access permission limits.
The example URL I am attempting to download from is:
https://www.mysite.org/download-image.php?imageurl=https://www.mysite.org/large/image.jpg
This doesn’t work if I click on the icon, but works (the dialogue box appears) if I copy and paste it into the URL field of my browser.The one that always works is:
https://www.mysite.org/download-image.php?imageurl=https://www.mysite.org/wp-content/uploads/image.jpgAs you can see, the only difference is the position of the target image.
As a test, I moved the image around the folder structure and the problem only appears when attempting to download data that is anywhere outside the wp-content folder.It looks like an access permission problem. I set CHMOD permissions to 777 for the “large” folder and the images it contains, but that did not work either.
I think something at the .htaccess must be configured for that “large” folder to be accessible in download mode.Some other web pages suggest that it could be possible to edit wp-config.php to change access permissions for folders, but I haven’t found out how to do that specifically.
I am lost again, as I have noticed 2 problems with the newly-added image download functionality. It seems to only work for images uploaded through WP media library. I have created a folder structure at the root level (where the WP files are) to store the large images. I pass the correct path via the ‘largeimage’ custom field but, instead of opening the “Save As” dialogue box, an empty page is opened. I thought this could be due to my host caching the changes I make and hence they take time to propagate, but now I am starting to suspect it may be related to where images are stored (although the full URL is passed in the custom field, so the path should not be an issue).
I would prefer to avoid uploading images via the WP media library, as it reveals the WP nature of the website through its silly absolute URLs for images (permalinks do not mask them) and creates a lot of redundant thumbnails.Another (less important) issue appears when I click “Cancel” on the “Save As” dialogue box, instead of actually saving the image. After I do that, the save icon on the thumbnail no longer works (it goes into an inactive state). Only after clicking somewhere else or refreshing the page it then reverts back to work. I wonder if I can add anything to the code to perform an icon refresh operation, so to speak.
Thanks
Would such .htaccess rule work with my initial code, as it is?
<a class="saveimage-icon" href="<?php echo get_post_meta($post->ID,'largeimage',true); ?>">Download <?php the_title(); ?></a>
I will try it when I have more time.
I will also have a look at StackOverflow, thank you for the suggestion.
All the best.
Dear linux4me2,
thank you very much for your helpful answer.
I used your script on one sample image and it works.
I had to add a “/” before the ‘download-image.php?imageurl=’ in my modified php code. I noticed it was missing by hovering the mouse over the download icon.What kind of rule should I insert in .htacces to obtain the same result?
I am interested in understanding that method as well, as my website is about image sharing anyway, so I do not mind if visitors download all of it.BTW, what would be a more appropriate section of the forum to post this type of help requests?