Problem for add image to post

Posted in: Newspaper
Post count: 13

Hi,

I am using php to upload image in wordpress media. Then I get it url and add to post content with img tag. I use wp_insert_port to add new post.

however, when I edit post in dashboard, I found that our image url (in html content) has been change, it seems it add size of image to image url.

How could I fix that?

Thanks!

Post count: 6600

Hi,

I’m not sure what issue you have, could you please provide more details and a screenshot would also help.

Thanks

Post count: 9544

WordPress creates thumbnails for the theme based on the sizes set for the theme, so that all those little photos on indexes and home pages actually show up, based on the image you choose for featured image. When WP does this, it adds the sizes for each new version which is logical vs item1, item2, item3, etc. The sizes are added to end of the thumbnail to show which size it is and also so WP knows which image to use for the specific “featured” image sizes when loaded by theme.

Put another way if you have, say 150×50 thumbnails on the site, as part of theme design and upload a 600×350 image, WordPress will then make a yourfilename-150×50.jpg so that the thumbnail is used on home page and not your big image resized to fit, which would slow the page wayyyyy down. This is how WordPress works with images.

See the WordPress codex for more info on how WordPress builds images.

  • This reply was modified 11 years by simchris.
Post count: 13

sorry, it i my code problem which using thumbnailId instead of upload photoId.

Thanks for your replies!

Post count: 13

however I do not know why when I set content which has image (for example src=”http://mydomain.com/wp-content/uploads/2014/12/hqdefault9.jpg”), after call wp_insert_post, the image in content has been changed. It converts to src=”http://i0.wp.com/mydomain.com/wp-content/uploads/2014/12/hqdefault9.jpg?resize=150%2C150″, it is thumbnail (or feature image) of post.

Post count: 1291

Hi,

You’re using Jetpack Photon and the image is loaded via CDN – http://jetpack.me/support/photon/

Thank you, Emil G.

Post count: 13

correct! however, photon said:
How does Photon determine which dimensions to serve?
Photon looks at the img element’s width and height attributes and then serves an image resized to those dimensions or to the width of the containing element (whichever is smaller).

My original image with much higher width and height, so is it the problem of “width of the containing element”? if that is, how could I solve now without photon disable?

Thanks!

Post count: 1291

Hi,

It delivers images based on the thumbnails size which are defined in the theme inside functions.php – http://screencast.com/t/fYG44rWY

And the default wordpress thumbnails – http://screencast.com/t/vPohkdnO4bg1

I’m not sure what you want to do, please provide more details.

Thank you, Emil G.

Post count: 13

Hi,
Thanks for reply!
I have disabled Photon but the error still similar.
I would like the image url in content is not changed. For example, the post below:
http://laughworld.net/hahaahhahaha-d-phit-like-y/
It change image url in content to thumbnail image:
http://laughworld.net/wp-content/uploads/2014/12/0d24fae0c4ffa1209bec32c990cd5e79-150×150.jpg
while I set the image url to http://laughworld.net/wp-content/uploads/2014/12/0d24fae0c4ffa1209bec32c990cd5e79.jpg when create post content (by PHP code)

So what I would like is the content is not changed from what I set.

Thank you,
Alex

Post count: 6600

Hi,

Not sure I understand how this is happening. I suggest you check the method you use to create your post content and also try this without any plugin active.

Thanks

Viewing 10 posts - 1 through 10 (of 10 total)
The forum ‘Newspaper’ is closed to new topics and replies.