Support Forum

Blog post linking does not show images

28 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

Yes- it would now be useful to know what the forum post content is in the database itself. Is that going to be possible?

Table ‘sfposts’ – column ‘post-content’ – well one of the last posts in the table…

PE Petra
Petra
Member

<a href=”http://www.capelle-fotografeert.nl/?attachment_id=1855″ rel=”attachment wp-att-1855″><img class=”alignnone size-large wp-image-1855″ src=”http://www.capelle-fotografeert.nl/wp-content/uploads/2012/11/IMG_0052-800×600.jpg” alt=”” width=”800″ height=”600″ /></a>

YS Yellow Swordfish
Yellow Swordfish
Member

That’s a different post but that should be OK as long as it has not been edited since it’s creation.

Would you be able and willing to make a small code edit to a core file so that we can dump some data to the screen,. This can be immediately reverted of course.

PE Petra
Petra
Member

<a href=”http://www.capelle-fotografeert.nl/wp-content/uploads/2012/11/IMG_0052.jpg”><img class=”alignnone size-large wp-image-1855″ src=”http://www.capelle-fotografeert.nl/wp-content/uploads/2012/11/IMG_0052-800×600.jpg” alt=”” width=”800″ height=”600″ /></a>

This one is of the post we were talking about, sorry, took the last one, didn’t think or look :( .

 

As long as you talk me through it, I don’t think that has to be a problem. I’ll start making a copy of the file I have to edit :) .

YS Yellow Swordfish
Yellow Swordfish
Member

Ok – sounds good. The file in question is simple-press/sp-api/sp-api-filters.php.

This is a big file I am afraid but the function we need is called sp_format_display_image($match) and is over half way down – starting around line 1170.

The portion of code to look for is:

# see if we can determine if the image still exists before going further. So is it relative?
if (substr($src[1], 0, 7) == 'http://') {
    $response = wp_remote_get($src[1]);
    if (is_wp_error($response) || wp_remote_retrieve_response_code($response) != 200) {
        return '['.sp_text('Image Can Not Be Found').']';
    }
}

What I would like to do is comment out that return statement and temporarily replace it with the following:

# see if we can determine if the image still exists before going further. So is it relative?
if (substr($src[1], 0, 7) == 'http://') {
    $response = wp_remote_get($src[1]);
    if (is_wp_error($response) || wp_remote_retrieve_response_code($response) != 200) {
//        return '['.sp_text('Image Can Not Be Found').']';
        return wp_remote_retrieve_response_code($response);
    }
}

This will (a) have the effect of pin-pointing where the problem lay and (b) showing us what the status is that WP is reporting back to us. The response code should show up in the post when the page is re-loaded

Hopefully this will shed some light on the issue. If the response code is 200 then I will probably have to ask you to make a further edit I am afraid but at least we will have discounted the first and obvious possibility.

Please remember to use a plain text editor and not a word processor for this!

PE Petra
Petra
Member

Okay, made a copy and edited the text. Leave the rest up to you :) .

Was thinking you might wanted the info from the db: 

Test foto voor probleem met forum posts

 

<a href=”http://www.capelle-fotografeert.nl/wp-content/uploads/2012/10/9800.jpg”><img class=”alignnone size-large wp-image-1754″ src=”http://www.capelle-fotografeert.nl/wp-content/uploads/2012/10/9800-800×266.jpg” alt=”” width=”800″ height=”266″ /></a>

YS Yellow Swordfish
Yellow Swordfish
Member

Well that was a disappointing result! No response code at all. Not sure what to make of that.

Can you edit some more? Remove that whole block of code – those lines shown in the previous post. Just comment them all out and see what happens…

PE Petra
Petra
Member

Okay, removed the whole section and was curious enough to take a quick peak :) . Image is showing now. How to proceed further? Make a backup of system and reference of change for own admin or ?…. 

See your response in the morning, going to bed now knowing this works (temp or def… laugh)

PE Petra
Petra
Member

@ Yellow Swordfish

First of all thanks for the support and patience :)

Do I need to do anything else, or can I remove the test of the blog/forum and make a note of the changes made?

YS Yellow Swordfish
Yellow Swordfish
Member

I too called it a night here in the UK!

For now I would leave those code changes in place and monitor your posts. Meanwhile I have opened a ticket to investigate why the WP call failed to respond as expected and when we find that out we will get a fix in the next update of SP so all should be well after that.

Thanks for helping us track it down – now we just have to solve the puzzle!

MP Mr Papa
Mr Papa
Member

missing something here…  if the wp_remote_get() does not return any response, that is bad…  error condition… might be server timing out or other… but we cannot just assume its good…  not sure what we would do for a server not returning a response…

ND Nico Derks
Nico Derks
Member

I followed this topic due same problems.

By using:

// return ‘[‘.sp_text(‘Image Can Not Be Found’).’]’;

Also here the problem seems to be solved.

 

Regards,
Nico

YS Yellow Swordfish
Yellow Swordfish
Member

Oh dear. Most strange. We can’t replicate this issue at all.

MP Mr Papa
Mr Papa
Member

but still investigating… you are the third person with this issue, so luckily quite rare…