imagecreatefrompng('ninja.jpg')
опечатка? (т.е. загрузка JPEG в imagecreatefrompng
который ожидает PNG).
Когда я загружаю JPEG в imagecreatefrompng
, это показывает, что только URL изображения как Вы описывает. Когда я загружаю изображение водяного знака PNG, оно работает просто великолепно.
Примечание: Я нахожусь в Windows, похоже, что Вы находитесь на Linux. Ваш пробег может vary™, но я не думаю очень.
Finally I found the solution, It must to setup a DNS server in your local network, if you have any Server Edition OS computer it will be easy to config its DNS server and point it to your projects IP. but when there is no Server Computer in the network (eg: home networks) the problem will be finding a DNS server to curry the responsibility.
I will config Apache on Windows 7 or anything else to handling Django projects with WSGI...
my local IP is 192.168.2.2 and I Bind it with my MAC-ADDRESS in the Router Settings.
NOTICE: be sure to make your IP to be unchangeable, otherwise it will make your DNS Server and local Network unstable.
first step is to config Apache to run the projects:
below will serve myProject1 on www.myproject1.local and myProject2 on www.myproject2.local
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.myProject1.local
ServerAlias myProject1.local *.myProject1.local
ServerAdmin my-email@gmail.com
DocumentRoot "C:/path/to/myProject1/"
</VirtualHost>
<VirtualHost *:80>
ServerName www.myProject2.local
ServerAlias myProject2.local *.myProject2.local
ServerAdmin my-email@gmail.com
DocumentRoot "C:/another/path/to/myProject2/"
</VirtualHost>
...
for more informations visit : [Apache Name-based Virtual Host Support]
if you want to serve a PHP project its works, but to config WSGI you have to make a little changes like below. I treat project1 to be django project
<VirtualHost *:80>
ServerName www.myProject1.local
ServerAlias myProject1.local *.myProject1.local
ServerAdmin my-email@gmail.com
#WSGIDaemonProcess myProject1 processes=2 threads=15 display-name=%{GROUP}
#WSGIProcessGroup myProject1
WSGIScriptAlias / "C:/path/to/myProject1/myproject1.wsgi"
</VirtualHost>
...
Be sure to load : [mod_wsgi.so]
commented lines WSGIDaemonProcess and WSGIProcessGroup are options to perform better WSGI service for more informations visit : [mod_wsgi Wiki Pages]
now you must config your dns server. in my case I have no dns server installed on my computer so first step is to find proper dns server to do the job.
I Use [MaraDNS], and config it like below:
mararc file
ipv4_bind_addresses = "192.168.2.2"
timestamp_type = 2
random_seed_file = "secret.txt"
hide_disclaimer = "YES"
csv2 = {}
csv2["myproject1.local."] = "db.default.txt"
csv2["myproject2.local."] = "db.default.txt"
upstream_servers = {}
upstream_servers["."] = "yyy.yyy.yyy.yyy, zzz.zzz.zzz.zzz"
and the db.default.txt file like below
% 192.168.2.2 ~
www.% 192.168.2.2 ~
for more information about maraDNS visit MaraDNS Website
Lunch maraDNS Server by
maradns -f mararc
you could access your domains by setting primary DNS server to point to 192.168.2.2 for each computer in your local network. but you also could set the Router DHCP server to use your IP as the default DNS Server. it just need access to the Router web-Administration.
so enter your IP there as DNS Server and the job is done.
now you can to serve your projects in local network as faked domains without using :port-number or IP addresses.
just enter myproject1.local in address-bar of any of your local network computer or WiFi devices and get the right result.
:)
То, что вы пытаетесь сделать, это установить несколько IP-адресов на одном хосте, а не имена доменов. Есть несколько проблем с тем, что вы пытаетесь сделать: Сначала вы, кажется, устанавливаете файл hosts
только на машине, на которой запущено серверное приложение, что означает, что никакая другая машина в сети не будет знать о них .
Другая проблема заключается в том, что для установки нескольких IP-адресов на одном и том же хосте вы должны сделать это в вашей сетевой конфигурации, и то, как это сделать, зависит от используемой вами операционной системы.
В-третьих, что вам не нужен один IP-адрес на хост. Один IP-адрес может иметь несколько имен хостов. Он либо настроен на сервере имен, либо, если у вас его нет для локальной сети,