0

UPDATE: If anyone is looking for answer - how to import ... great reply is there: https://stackoverflow.com/a/7894485/1068055

I am unable find answer and I am stuck for a day studying ObjectModel and classes, too...

I have a valid Product object. I have 1 url for cover image, 2 url for antoher images of product. I am able to copy the images to my server. But then I am stuck :/ I dont know, how to exactly create an Image object and then bing it to the product?

Any help? Don't need entire script, just the logic.

I was looking for something like that:

  1. ImageCore::createFromTempFile()
  2. Product::addImage()

I tried:

add1:

$img = new ImageCore()
$img->id_product = $prod->id
$img->cover = TRUE/FALSE

.. and stuck there :// Unable to find out, how to transfer the image_data to this object :( I have the image in tmp directory, e.g. $tmpFileName...

4

1 回答 1

1
$img->data = file_get_contents ( $image );
于 2013-06-23T18:39:17.473 回答