problema con nome file immagine prodotto

Postate qui discussioni di carattere generale riguardo a problemi di installazione e configurazione di osCommerce

Moderatore: mod Generali

shop155
membro Junior
membro Junior
Messaggi: 48
Iscritto il: 29/03/2008, 14:28

problema con nome file immagine prodotto

Messaggio da shop155 »

salve a tutti
ho un versione di os commerce 2-2 ms2
il mio problemino è che tutte le volte che carico on line una foto(foto.jpp) ad esempio metto un nuovo prodotto e quindi carico la foto
la realativa foto nella cartella image non ha il nome foto.jpg ma un nome alfanumerico tipo 4829406fc26a6e042439ea146f71e264.jpg
come mai?
ai fini del posizionamente è negativo
ma anche quando devo fare una ricerca io personalmente delle foto caricare.
esiste qualche cosa che devo sbloccare per far si che la foto non cambi nome?
resto in attesa
grazie
shop155
membro Junior
membro Junior
Messaggi: 48
Iscritto il: 29/03/2008, 14:28

Re: problema con nome file immagine prodotto

Messaggio da shop155 »

nessuno sa aiutarmi?
vampire
membro Veteran
membro Veteran
Messaggi: 810
Iscritto il: 24/04/2008, 11:48
Località: Italia
Contatta:

Re: problema con nome file immagine prodotto

Messaggio da vampire »

Ciao,

io non ti so aiutare....ma cmq ai fini del posizionamento è molto importante il seo-url non il nome delle immagini :P
VHosting Solution
Web Hosting Da 26 Euro Annuo
OsCommerce Hosting 144 Euro Annuo
15% di sconto con il codice: OSC-Member su WebHosting - OSC Hosting
http://www.vhosting-it.com
info@vhosting-it.com
Avatar utente
lavoriamopervoi
membro Senior
membro Senior
Messaggi: 405
Iscritto il: 14/12/2007, 18:32
Contatta:

Re: problema con nome file immagine prodotto

Messaggio da lavoriamopervoi »

shop155 ha scritto:nessuno sa aiutarmi?
usi qualche contribution per rimpicciolire le immagini?
shop155
membro Junior
membro Junior
Messaggi: 48
Iscritto il: 29/03/2008, 14:28

Re: problema con nome file immagine prodotto

Messaggio da shop155 »

credo che ci sia qualche contribuition attiva per rimpicciolire le immagini
ma non so in quanto vedo solo che la stessa immagine è chiamata small , medium , large e thumb...
vi viene in mente qualcosa?
shop155
membro Junior
membro Junior
Messaggi: 48
Iscritto il: 29/03/2008, 14:28

Re: problema con nome file immagine prodotto

Messaggio da shop155 »

se ci fosse questa contribution come si chiama?
como posso fare per non farle cambiare il nome alle immagini?
Avatar utente
lavoriamopervoi
membro Senior
membro Senior
Messaggi: 405
Iscritto il: 14/12/2007, 18:32
Contatta:

Re: problema con nome file immagine prodotto

Messaggio da lavoriamopervoi »

shop155 ha scritto:se ci fosse questa contribution come si chiama?
como posso fare per non farle cambiare il nome alle immagini?
questo dipende appunto dalla contribution installata...
posta la funzione tep_image()...
presente in includes/functions/html_output.php
per vedere di cosa si tratta...

Ciao
Antonello
shop155
membro Junior
membro Junior
Messaggi: 48
Iscritto il: 29/03/2008, 14:28

Re: problema con nome file immagine prodotto

Messaggio da shop155 »

eccola.fatemi sapere come posso fare o modificare questa funzione affinche' non mi cambi piu' il nome.grazieeee

Codice: Seleziona tutto

function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '', $image_format_type = 'small', $absurl = false) {

	if (empty($src)) {
		return false;
	}

	if (!(strpos($src,'http://') === false)) {

		$substring_lengt = strlen($src) - strlen(DIR_WS_IMAGES);
		
		$src = substr($src, -$substring_lengt); 
		
		$image = '<img src="' . $src . '" border="0" alt="' . tep_output_string($alt) . '"';

		if (tep_not_null($alt)) {
			$image .= ' title=" ' . tep_output_string($alt) . ' "';
		}

		if (tep_not_null($width)) {
			$image .= ' width="' . tep_output_string($width) . '"';
		}

		if (tep_not_null($height)) {
			$image .= ' height="' . tep_output_string($height) . '"';
		}

		if (tep_not_null($parameters)) $image .= ' ' . $parameters;

		$image .= '>';

		return $image;

	} else {

		//Get file info
		$pathinfo_array = pathinfo($src);
		$file_name = $pathinfo_array['basename'];
		$file_extension = $pathinfo_array['extension'];

		//Set $file_ws_path for images files
		$file_ws_path = $pathinfo_array['dirname'];
		if (substr($file_ws_path, -1) != '/') $file_ws_path .= '/';

		//Set $file_fs_path for images files
		if (substr($file_ws_path, 0, 1) == '/') {
			$file_fs_path = DIR_FS_CATALOG . substr($file_ws_path, strlen(DIR_WS_CATALOG));
		} else {
			$file_fs_path = DIR_FS_CATALOG . $file_ws_path ;
		}

		$image_ws_path = $file_ws_path . $file_name;
		$image_fs_path = $file_fs_path . $file_name;


		if (($file_fs_path == DIR_FS_CATALOG_IMAGES) || ($file_fs_path == DIR_FS_CATALOG_IMAGES_EXTRA)) {

			$file_name_prefix = substr($file_name, 0, -(strlen($file_extension) + 1));

			switch ($image_format_type) {
				case 'thumb':
				$resize_image_ws_path = $file_ws_path . $file_name_prefix . '_thumb' . '.' . $file_extension;
				$resize_image_fs_path = $file_fs_path . $file_name_prefix . '_thumb' . '.' . $file_extension;
				break;
				case 'small':
				$resize_image_ws_path = $file_ws_path . $file_name_prefix . '_small' . '.' . $file_extension;
				$resize_image_fs_path = $file_fs_path . $file_name_prefix . '_small' . '.' . $file_extension;
				break;
				case 'medium':
				$resize_image_ws_path = $file_ws_path . $file_name_prefix . '_medium' . '.' . $file_extension;
				$resize_image_fs_path = $file_fs_path . $file_name_prefix . '_medium' . '.' . $file_extension;
				break;
				case 'large':
				$resize_image_ws_path = $file_ws_path . $file_name_prefix . '_large' . '.' . $file_extension;
				$resize_image_fs_path = $file_fs_path . $file_name_prefix . '_large' . '.' . $file_extension;
				break;
				default:
				$resize_image_ws_path = $file_ws_path . $file_name_prefix . '_small' . '.' . $file_extension;
				$resize_image_fs_path = $file_fs_path . $file_name_prefix . '_small' . '.' . $file_extension;
			}


			if (file_exists($resize_image_fs_path) && is_file($resize_image_fs_path)) {

				if ($image_size = @getimagesize($resize_image_fs_path)) {
					$width = $image_size[0];
					$height = $image_size[1];

					/*
					switch ($image_format_type) {

					case 'thumb':
					if ( !(($width == PRODUCTS_THUMB_IMAGE_SIZE) || ($height == PRODUCTS_THUMB_IMAGE_SIZE)) ) {
					$ratio = $width / $height;
					if ($width >= $height) {
					$width = PRODUCTS_THUMB_IMAGE_SIZE;
					$height = round($width / $ratio);
					} else {
					$height = PRODUCTS_THUMB_IMAGE_SIZE;
					$width = round($height * $ratio);
					}
					}
					break;

					case 'small':
					if ( !(($width == PRODUCTS_SMALL_IMAGE_SIZE) || ($height == PRODUCTS_SMALL_IMAGE_SIZE)) ) {
					$ratio = $width / $height;
					if ($width >= $height) {
					$width = PRODUCTS_SMALL_IMAGE_SIZE;
					$height = round($width / $ratio);
					} else {
					$height = PRODUCTS_SMALL_IMAGE_SIZE;
					$width = round($height * $ratio);
					}
					}
					break;

					case 'medium':
					if ( !(($width == PRODUCTS_MEDIUM_IMAGE_SIZE) || ($height == PRODUCTS_MEDIUM_IMAGE_SIZE)) ) {
					$ratio = $width / $height;
					if ($width >= $height) {
					$width = PRODUCTS_MEDIUM_IMAGE_SIZE;
					$height = round($width / $ratio);
					} else {
					$height = PRODUCTS_MEDIUM_IMAGE_SIZE;
					$width = round($height * $ratio);
					}
					}
					break;

					case 'large':
					if ( !(($width == PRODUCTS_LARGE_IMAGE_SIZE) || ($height == PRODUCTS_LARGE_IMAGE_SIZE)) ) {
					$ratio = $width / $height;
					if ($width >= $height) {
					$width = PRODUCTS_LARGE_IMAGE_SIZE;
					$height = round($width / $ratio);
					} else {
					$height = PRODUCTS_LARGE_IMAGE_SIZE;
					$width = round($height * $ratio);
					}
					}
					break;
					}*/

				} else {
					return 'Getimagesize error in virtual thumb/small/medium/large resize';
				}

				$new_src = $resize_image_ws_path;

			} elseif (file_exists($image_fs_path) && is_file($image_fs_path)) {

				if ($image_size = @getimagesize($image_fs_path)) {
					$get_width = $image_size[0];
					$get_height = $image_size[1];

					switch ($image_format_type) {

						case 'thumb':
						$ratio = $get_width / $get_height;
						if ($get_width >= $get_height) {
							$width = PRODUCTS_THUMB_IMAGE_SIZE;
							$height = round($width / $ratio);
						} else {
							$height = PRODUCTS_THUMB_IMAGE_SIZE;
							$width = round($height * $ratio);
						}
						break;

						case 'small':
						if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {
							if (empty($width) && $height) {
								$ratio = $height / $image_size[1];
								$width = round($image_size[0] * $ratio);
							} elseif ($width && empty($height)) {
								$ratio = $width / $image_size[0];
								$height = round($image_size[1] * $ratio);
							} elseif (empty($width) && empty($height)) {
								$width = $image_size[0];
								$height = $image_size[1];
							}
						}
						break;

						case 'medium':
						$ratio = $get_width / $get_height;
						if ($get_width >= $get_height) {
							$width = PRODUCTS_MEDIUM_IMAGE_SIZE;
							$height = round($width / $ratio);
						} else {
							$height = PRODUCTS_MEDIUM_IMAGE_SIZE;
							$width = round($height * $ratio);
						}
						break;

						case 'large':
						$ratio = $get_width / $get_height;
						if ($get_width >= $get_height) {
							$width = PRODUCTS_LARGE_IMAGE_SIZE;
							$height = round($width / $ratio);
						} else {
							$height = PRODUCTS_LARGE_IMAGE_SIZE;
							$width = round($height * $ratio);
						}
						break;
					}

				} else {
					return 'Getimagesize error in virtual thumb/medium/large resize';
				}

				$new_src = $image_ws_path;

			} else {
				return false;
			}

		} elseif (file_exists($image_fs_path) && is_file($image_fs_path)) {

			if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {

				if ($image_size = @getimagesize($image_fs_path)) {

					if (empty($width) && $height) {
						$ratio = $height / $image_size[1];
						$width = round($image_size[0] * $ratio);
					} elseif ($width && empty($height)) {
						$ratio = $width / $image_size[0];
						$height = round($image_size[1] * $ratio);
					} elseif (empty($width) && empty($height)) {
						$width = $image_size[0];
						$height = $image_size[1];
					}

				}

			}

			$new_src = $image_ws_path;

		} else {
			return false;
		}

		// alt is added to the img tag even if it is null to prevent browsers from outputting
		// the image filename as default
		$image = '<img src="' . (($absurl) ? tep_output_string(HTTP_SERVER . '/' . $new_src) : tep_output_string($new_src)) . '" border="0" alt="' . tep_output_string($alt) . '"';

		if (tep_not_null($alt)) {
			$image .= ' title=" ' . tep_output_string($alt) . ' "';
		}

		if (tep_not_null($width)) {
			$image .= ' width="' . tep_output_string($width) . '"';
		}

		if (tep_not_null($height)) {
			$image .= ' height="' . tep_output_string($height) . '"';
		}

		if (tep_not_null($parameters)) $image .= ' ' . $parameters;

		$image .= '>';

		return $image;

	}
}
shop155
membro Junior
membro Junior
Messaggi: 48
Iscritto il: 29/03/2008, 14:28

Re: problema con nome file immagine prodotto

Messaggio da shop155 »

fatemi sapere vi prego..
shop155
membro Junior
membro Junior
Messaggi: 48
Iscritto il: 29/03/2008, 14:28

Re: problema con nome file immagine prodotto

Messaggio da shop155 »

non mi abbandonate vi prego e scusate se insisto!
Avatar utente
lavoriamopervoi
membro Senior
membro Senior
Messaggi: 405
Iscritto il: 14/12/2007, 18:32
Contatta:

Re: problema con nome file immagine prodotto

Messaggio da lavoriamopervoi »

shop155 ha scritto:non mi abbandonate vi prego e scusate se insisto!
potresti installare un'altra contribution per creare il ridimensionamento automatico delle immagini...
tipo: 'On the Fly' Auto Thumbnailer using GD Library

Ciao
Antonello
shop155
membro Junior
membro Junior
Messaggi: 48
Iscritto il: 29/03/2008, 14:28

Re: problema con nome file immagine prodotto

Messaggio da shop155 »

ho dato un occhiata alla tua contribution
grazie!
ma dovrei anche toccare il database?
Avatar utente
lavoriamopervoi
membro Senior
membro Senior
Messaggi: 405
Iscritto il: 14/12/2007, 18:32
Contatta:

Re: problema con nome file immagine prodotto

Messaggio da lavoriamopervoi »

shop155 ha scritto:ho dato un occhiata alla tua contribution
grazie!
ma dovrei anche toccare il database?
no
shop155
membro Junior
membro Junior
Messaggi: 48
Iscritto il: 29/03/2008, 14:28

Re: problema con nome file immagine prodotto

Messaggio da shop155 »

ok allora lo provo...
speriamo bene!
shop155
membro Junior
membro Junior
Messaggi: 48
Iscritto il: 29/03/2008, 14:28

Re: problema con nome file immagine prodotto

Messaggio da shop155 »

ho provato ma non mi fa vedere le immagini dal lato cliente e mi genera tanti errori...
ma non esiste un modo per capire dove siia la funzione che mi cambia il nome delle immagini che carirco?
Rispondi