duandui2803
2013-06-23 18:02
浏览 45
已采纳

Prestashop图像从url导入到产品

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...

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dssj88098 2013-06-23 18:39
    已采纳
    $img->data = file_get_contents ( $image );
    
    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题