1

I need to obtain the final url for an image to set it as parameter to a JQuery Datepicker input. The way to declare the DatePicker is:

$("#myInput").datepicker({
    showOn: "button",
    buttonImage: "<url-for-the-image>",
    buttonImageOnly: true
});

I know in symfony the images are located (by default) in the /web/images directory, and this can be accessed with sfConfig::get('sf_web_dir').'/images'.

The probelm is that this function returns me something like /var/www/.../web/images instead of http://-IP-ADDRESS-/.../web/images.

How can i do it to find the correct url for an image in my image directory? Thank you very much!

1 Answer 1

2

OK, solved! just using this Symfony function: image_path('my-image.png'); This returns the path to the image!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.