0

I have a backend and a frontend. In the frontend all is right. The image link is correct and the image is displayed.

/img/imgProducts/Coda_VolpeAmineo%20Coda%20di%20Volpe%20IGP%206%20bottiglie%20?1367589931

In the backend, same code, I have a blank image.

/img/imgProducts/Coda_VolpeAmineo%20Coda%20di%20Volpe%20IGP%206%20bottiglie%20

Why in the frontend I see that random number? Without that the image is blank. Who is putting that number?

The code is

 echo ($html->image(($this->data['Product']['imagelink']),array('title'=>$this->data['Product']['name'],'width'=>80 )));

2 Answers 2

2

Asset timestamping

The random number at the end of the URL is a timestamp, used to prevent caching older versions of the image by webbrowsers.

By default, timestamping assets (images) is disabled, but it may be enabled during development (I.e. when 'debug' is enabled), but can also be forced by setting the Asset.timestamp configuration inside app/Config/core.php to 'force'

Look for Configure::write('Asset.timestamp', true); in your app. See this line inside the core.php configuration file:

https://github.com/cakephp/cakephp/blob/master/app/Config/core.php#L212

important

If you're seeing timestamps in your URLs, this may be caused by debug being enabled inside app/Config/core.php. Running a live website with debug enabled is really discouraged. Not only will this make your website slow (as server-side caching is disabled), it will also output error-messages inside the browser, which may be a security risk in some cases!

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

2 Comments

I knew about debug mode, but I didn't know about the Asset.timestamp.
It's not a very well-known feature, but handy during development to prevent caching. Anyway, glad I could help!
2

That's a URL encoded image link.. You probably have spaces and other characters in the filename of your image.

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.