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

Add server url to image on serialization #451

Closed
manelselles opened this issue May 7, 2015 · 3 comments
Closed

Add server url to image on serialization #451

manelselles opened this issue May 7, 2015 · 3 comments

Comments

@manelselles
Copy link

I have an attribute which references the path inside the public directory to a certain image.

When I serialize the entity I want this attribute to be prefixed with server url to obtain the absolute URL to the image.

Example:

Any way to add this prefix to the serialized attribute? I could obtain the server url from the request but I don't know how to send/inject to the serializer.

Thank you!

@ghost
Copy link

ghost commented May 7, 2015

Hi,

You may use the PRE_SERIALIZE event.

2015-05-07 9:38 GMT+02:00 manelselles [email protected]:

I have an attribute which references the path inside the public directory
to a certain image.

When I serialize the entity I want this attribute to be prefixed with
server url to obtain the absolute URL to the image.

Example:

Attribute: img/product/323124.jpg

Desired: www.serverwithimages.com/img/product/323124.jpg

Any way to add this prefix to the serialized attribute? I could obtain the
server url from the request but I don't know how to send/inject to the
serializer.

Thank you!


Reply to this email directly or view it on GitHub
#451.

Benoit Henner
18 Avenue du 8 Mai 1945
57300 HAGONDANGE
Tél. : 00336 75 39 47 39
Tél. : 00339 50 57 92 82

@manelselles
Copy link
Author

Thank you! It works perfect now!

@goetas
Copy link
Collaborator

goetas commented Jan 20, 2017

Sorry for the long feedback loop. This issue looks solved.

(if not feel free to re open the issue or to comment here)

Thanks

@goetas goetas closed this as completed Jan 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants