Viewing 10 replies - 1 through 10 (of 10 total)
  • The first thing I’d check is to go in the admin side, Settings -> General and make sure that the settings for WordPress address and Site Address both are set to http://markblower.com/blog with the “blog” on the end there.

    If you already had those settings correct, you may need to change the path to the images in your posts table in the database. Post back if that’s the case.

    Thread Starter markblower

    (@markblower)

    Hi,

    Thanks for getting back to me. The settings for WordPress address and Site Address both are set to http://markblower.com/blog with the “blog” on the end.

    M

    Okay, good deal. Next step, I would start with one of the images that has the incorrect path. Log into the admin side of WordPress and go Media -> Library. Find that specific image.

    In the posts table of your database, each post and image is listed by an ID number. You can get the specific ID number for an image by hovering your mouse over any of the links for an image in Media -> Library. The link will show in the status bar of most browsers, and the link will look something like this:
    http://yourdomain.com/wp-admin/post.php?post=X&action=edit
    where “X” is the integer ID of the post. Save that number.

    Now you need to take a look at your database. Hopefully, your web host makes something like phpMyAdmin available to do that.

    Go into phpMyAdmin, click on the link in the left column that corresponds to your WordPress database. Then click on the link for the “posts” or “wp_posts” table. Page through until you find the record for the image with the ID you got above. Now look at the “guid” field for that image. If the path doesn’t have the “/blog” in there, I think you’ve found the problem and the solution.

    To test a fix, click on the Edit link for that record, scroll down to the guid field, add the “/blog” so the path to the image is correct, and click the “Go” button to save your changes. Verify that the “guid” field now reflects the correct path to the image. If it does, reload your browser on the page for the site that displays that image and see if it fixed it. (You may need to clear your browser cache, Ctrl + F5 in Firefox.)

    If that fixes it, all you need to do is fix all the images so that the path is correct. Fortunately, that’s easy to do with phpMyAdmin and a single SQL update query. In phpMyAdmin, you click on the SQL toolbar button. Click the “Clear” button below the “Run SQL query/queries on database” box to clear the contents of the text area, then paste in the following query:
    Update wp_posts SET guid = REPLACE(guid, 'markblower.com/wp-content', 'markblower.com/blog/wp-content')
    Note that you will have to use the name of your posts table where I have “wp_posts.” What that query is doing is looking in all the guid fields in the wp_posts table and replacing the string “markblower.com/wp-content” with the string “markblower.com/blog/wp-content.”

    If you don’t have access to phpMyAdmin, there used to be a plugin that would do this for you, too, so all is not lost.

    Thread Starter markblower

    (@markblower)

    Thanks so much for your help, a very comprehensive answer! The images were in a table called wp_yapbimage and the path didn’t contain /blog. There was a syntax error somewhere in the query you gave me but it didn’t take too long to change the strings by hand using inline edit and all the images are now showing up.

    Now I have an new problem, this appears at the top of the page when I click on the link to a post:

    Warning: file_get_contents() [function.file-get-contents]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/markblow/public_html/blog/wp-content/plugins/yet-another-photoblog/lib/Yapb.class.php on line 782

    Warning: file_get_contents(http://markblower.com/blog/wp-content/plugins/yet-another-photoblog/YapbThumbnailer.php?post_id=455&w=100&h=100) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /home/markblow/public_html/blog/wp-content/plugins/yet-another-photoblog/lib/Yapb.class.php on line 782

    The post looks fine otherwise.

    Yes, the query I gave you was for the posts table, not a yet-another-photoblog table. It wouldn’t work there because there probably isn’t even a guid field. I thought we were working with regular WordPress images.

    The way you did it will be fine, though.

    Your current error message appears to be due to a setting you have for PHP on the server which disables the function allow_url_fopen. Some servers disable certain functions, though allow_url_fopen is enabled by default. I think the second error message is a result of the first.

    If you have cPanel on your server and the utility called PHP QuickConfig is enabled, you can fix this yourself. Just enable QuickConfig, scroll down to where you can see allow_url_fopen, and set it to “on” or “1.” If you don’t have QuickConfig you will either have to create a custom php.ini for your server or contact your web host to enable allow_url_fopen and re-check for errors.

    Thread Starter markblower

    (@markblower)

    I do have cPanel but not QuickConfig unfortunately. I made a file called php.ini containing the text allow_url_fopen = On but that didn’t do anything. I put it in …/public_html and then tried in …//public_html/blog.

    M

    Thread Starter markblower

    (@markblower)

    And in the root folder.

    You can create a custom php.ini manually, but in addition to the php.ini, you have to tell PHP where to find it. The best place to put the php.ini is in your /home/<username> folder, rather than in a publicly accessible folder like /home/<username>/public_html.

    Then, to tell PHP how to find it on a server with PHP installed as a CGI Module, you create an .htaccess file in the /home/<username> folder with the following symlink in it:

    <IfModule mod_suphp.c>
     suPHP_ConfigPath /home/<username>/
     <Files php.ini>
       order allow,deny
       deny from all
     </Files>
    </IfModule>

    Substitute your username for your hosting account for “<username>.”

    I haven’t tried doing this with a single setting in the php.ini. I don’t know if that works or not. I have always used a modified version of the default php.ini for the version of PHP on the server, but you may have a time getting that from your host if you don’t have access to the folder where it is currently. I also can’t say if this will work on a server where PHP is run as an Apache module instead of CGI.

    Thread Starter markblower

    (@markblower)

    linux4me2,

    I tried everything you suggested but to no avail. Then I had a proper look at the function at:

    …/wp-content/plugins/yet-another-photoblog/lib/Yapb.class.php on line 782

    and turned it off. Problem solved!

    Thank you so much for taking the time to help me out.

    Mark

    Thread Starter markblower

    (@markblower)

    Resolved

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Broken image links YAPB’ is closed to new replies.