How to use "WOOF_Image :: save_image"

This topic is: not resolved


Viewing 5 posts - 1 through 5 (of 5 total)
Author Posts
October 2, 2015 at 10:27 am #3694
Post count: 43

I would like to upload the image path inputted into the custom field to my server, and to use it as a thumbnail.

In that case, it is “WOOF_Image :: save_image” useful?

October 2, 2015 at 12:14 pm #3695
Post count: 207

Hi so just to clarify, you’ve already put an image URL into another field, but you want to use the image from that path as a thumbnail? I assume the other field is not an image type?

WOOF_Image::save_image is not really for this purpose, as this requires an image handle from the standard PHP way of loading in an image.

Where is your image stored? If it’s inside your theme folder, you could use this method to get an image relative to the top of the theme path:

If it’s within wp-content, you could use the content_image method instead:

both of these will give you a WOOF_Image class which can then be used just like any image field, so you can call resize etc on the object.

October 2, 2015 at 5:13 pm #3696
Post count: 43

I am creating the list of the contents of an external site.

And I have inputted into the custom field (text field) the image set as OGP of each contents.

And I would like to upload the image path inputted at the time of preservation of a post to wp-content/uploads, and to use it as a thumbnail (Featured Image) of WordPress.

Since the post is imported by CSV, I cannot use URL download in the image field.

Can I use “WOOF_Image :: save_image” as how to download image URL inputted into the text field in such a situation?


October 6, 2015 at 10:19 am #3697
Post count: 207

Hey, save_image won’t help you here, as that is intended to load an existing image resource and save it out somewhere else.

I’m assuming you already have the image on the server inside wp-content/uploads, so you shouldn’t need to do that.

Are you trying to insert it into the core Feature Image field in WordPress? That would likely require you to insert an attachment to the post first, which is outlined here:

You may also need to generate the metadata:

And then you may also need to set the post meta to point to the new attachment ID:

On the other hand if you’re using a MasterPress custom image field, you should be able to set the VALUE of that field to be the full URL to the image, and MasterPress should be able to see that image inside your wp-content/uploads directory.

So if you had “wp-content/uploads/car.jpg”, you could set the value of an image field to:” and MasterPress should be able to recognise that image.

October 7, 2015 at 2:05 pm #3698
Post count: 43

I always thank exact support.

I try “wp_insert_attachment.”

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

Latest From the Blog

MasterPress 1.3.6 is now available

Masterpress 1.3.6 is a compatibility release. It resolves an edge case with shared fieldsets not working for MySQL 8 when the fieldset is limited to more than 1 post type or taxonomy or excluding any post types or taxonomies.

Plugin Requirements

MasterPress requires a minimum of WordPress version 4.9, MySQL 5.6, and PHP version 5.6.20.

We also recommend that PHP is configured to use a memory limit of 64MB per request (128MB may be required for sites with higher complexity).

This plug-in is not compatible with the hosted service.

Three AM