Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline Image wrappingStyle Not Working #244

Closed
andrew-kzoo opened this issue May 20, 2014 · 19 comments
Closed

Inline Image wrappingStyle Not Working #244

andrew-kzoo opened this issue May 20, 2014 · 19 comments

Comments

@andrew-kzoo
Copy link
Contributor

Image wrapping with wrappingStyle = 'inline' is not working correctly.

https://phpword.readthedocs.org/en/latest/elements.html#images

@ivanlanin
Copy link
Contributor

Hi @andrew-kzoo. I test with this code:

$textrun = $section->addTextRun('pStyle');
$textrun->addImage('resources/_earth.jpg', array( 'wrappingStyle' => 'inline', 'width' => 40, 'height' => 40));
$textrun->addText($lipsumText);

And here's what I got:
2014-05-21-161922-ss

The behaviour is like what I expected. Can you elaborate what's not working correctly? Thanks.

@andrew-kzoo
Copy link
Contributor Author

Yes, you are right. I ought to have dug into the documentation more deeply.

My interest is inserting an image with the proper text wrapping style to generate the following:
capture

@ivanlanin
Copy link
Contributor

Ok. I see what I can do.

@andrew-kzoo
Copy link
Contributor Author

Thank you! 😃

@ivanlanin ivanlanin self-assigned this May 21, 2014
@ivanlanin ivanlanin added this to the 0.11.0 milestone May 21, 2014
@ivanlanin ivanlanin added Enhancement and removed Bug labels May 21, 2014
ivanlanin added a commit to ivanlanin/PHPWord that referenced this issue May 21, 2014
@ivanlanin
Copy link
Contributor

Hi, @andrew-kzoo. Use the following code with the latest develop branch to produce the "float left" effect that you need.

$imageStyle = array(
    'width' => 40,
    'height' => 40
    'wrappingStyle' => 'square',
    'positioning' => 'absolute',
    'posHorizontalRel' => 'margin',
    'posVerticalRel' => 'line',
);
$textrun->addImage('resources/_earth.jpg', $imageStyle);
$textrun->addText($lipsumText);

Here's the screenshot of the result:
2014-05-21-233254-ss

@andrew-kzoo
Copy link
Contributor Author

Thank you x 💯!

@ivanlanin
Copy link
Contributor

You're most welcome. Please confirm and close this issue when you have time to test it. Thanks.

@Progi1984
Copy link
Member

@ivanlanin Could you add it as a cookbook in recipes of the documentation (https://phpword.readthedocs.org/en/latest/recipes.html), please ? I think it would be a good idea :)

@ivanlanin
Copy link
Contributor

Ah, so that's what "recipes" are. Ok. Will do.

@ivanlanin
Copy link
Contributor

Done: https://phpword.readthedocs.org/en/develop/recipes.html Are those items suitable for receipes?

@Progi1984
Copy link
Member

Perfect. Don't hesitate to add images :)

@andrew-kzoo
Copy link
Contributor Author

Again, my thanks to each of you for your excellent work!

https://phpword.readthedocs.org/en/develop/recipes.html#create-float-left-image has a typo:

'height' => 40,

@ivanlanin
Copy link
Contributor

Thanks, @andrew-kzoo. I'll fix it ASAP. Btw, have you got any chance to confirm that your issue was solved? Please close this issue when you've done that. Thanks.

Progi1984 added a commit that referenced this issue May 28, 2014
@Progi1984
Copy link
Member

@ivanlanin I fixed the typo error :)

@ivanlanin
Copy link
Contributor

Thanks!

@Progi1984 Progi1984 mentioned this issue May 29, 2014
6 tasks
@ivanlanin
Copy link
Contributor

Hi @andrew-kzoo. We're going to release 0.11.0 this weekend. Can we close this issue? Thanks.

@andrew-kzoo
Copy link
Contributor Author

Again, because your work is appreciated, thanks to each of you for your efforts!

@ivanlanin
Copy link
Contributor

You're welcome :) Thanks.

@skys215
Copy link

skys215 commented Oct 15, 2020

Is it also possible to float an image using setImageValue()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants